2016年8月22日 星期一

Switch Syslog Setup(temp)

#en
#config t
#logging 192.168.1.1   //(log主機)
#logging trap 4 //等級預設7(全部)
#end

#sh run



Configuring the UNIX System Logging Facility

When sending system log messages to an external device, you can cause the switch to identify its messages as originating from any of the UNIX syslog facilities.
Beginning in privileged EXEC mode, follow these steps to configure UNIX system facility message logging. This procedure is optional.








Command



Purpose
Step 1
configure terminal
Enter global configuration mode.
Step 2
logging host
Log messages to a UNIX syslog server host by entering its IP address.
To build a list of syslog servers that receive logging messages, enter this command more than once.
Step 3
logging trap level
Limit messages logged to the syslog servers.
Be default, syslog servers receive informational messages and lower. See Table 1-3 for level keywords.
Step 4
logging facility facility-type
Configure the syslog facility. See Table 1-4 for facility-type keywords.
The default is local7.
Step 5
end
Return to privileged EXEC mode.
Step 6
show running-config
Verify your entries.
Step 7
copy running-config startup-config
(Optional) Save your entries in the configuration file.

To remove a syslog server, use the no logging host global configuration command, and specify the syslog server IP address. To disable logging to syslog servers, enter the no logging trap global configuration command.
Table 1-4 lists the UNIX system facilities supported by the software. For more information about these facilities, consult the operator’s manual for your UNIX operating system.



Table 1-3Message Logging Level Keywords
Level Keyword
Level
Description
Syslog Definition
emergencies
0
System unstable
LOG_EMERG
alerts
1
Immediate action needed
LOG_ALERT
critical
2
Critical conditions
LOG_CRIT
errors
3
Error conditions
LOG_ERR
warnings
4
Warning conditions
LOG_WARNING
notifications
5
Normal but significant condition
LOG_NOTICE
informational
6
Informational messages only
LOG_INFO
debugging
7
Debugging messages
LOG_DEBUG

2016年8月10日 星期三

How to install Oracle Java 1.8 on Redhat 7

Oracle 的安裝方式比較瑣碎,故再重發一篇

Oracle java 1.8


cd /tmp

#下載安裝檔或是可預先下載檔案複製到 /opt
#其版本網址就自行依需求再調整
======
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u101-b13/jdk-8u101-linux-x64.tar.gz"
======


tar xzf jdk-8u101-linux-x64.tar.gz
cd /opt/jdk1.8.0_101/

alternatives --install /usr/bin/java java /opt/jdk1.8.0_101/bin/java 2
alternatives --config java
java -version

How to install Tomcat 8 on Redhat 7.2

=================
tomcat install
https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-centos-7
=================
環境前提,安裝JAVA 與設定環境
請參考http://yccitman.blogspot.tw/2016/08/how-to-install-oracle-java-18-on-redhat.html
===

mkdir /opt/tomcat

sudo groupadd tomcat

sudo useradd -M -s /bin/nologin -g tomcat -d /opt/tomcat tomcat


wget http://ftp.twaren.net/Unix/Web/apache/tomcat/tomcat-8/v8.0.36/bin/apache-tomcat-8.0.36.tar.gz


sudo mkdir /opt/tomcat
sudo tar xvf apache-tomcat-8*tar.gz -C /opt/tomcat --strip-components=1

cd tomcat
sudo chgrp -R tomcat conf
sudo chmod g+rwx conf
sudo chmod g+r conf/*
sudo chown -R tomcat webapps/ work/ temp/ logs/


sudo vi /etc/systemd/system/tomcat.service

=======

# Systemd unit file for tomcat
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target

[Service]
Type=forking

#Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment=JAVA_HOME=/opt/jdk1.8.0_101/jre
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/bin/kill -15 $MAINPID

User=tomcat
Group=tomcat

[Install]
WantedBy=multi-user.target


==============
sudo systemctl daemon-reload
sudo systemctl start tomcat
sudo systemctl enable tomcat

=============
sudo vi /opt/tomcat/conf/tomcat-users.xml
=====
tomcat-users.xml — Admin User
<tomcat-users>
    <user username="admin" password="password" roles="manager-gui,admin-gui"/>
</tomcat-users>

====

sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp
sudo firewall-cmd --permanent --zone=public --add-port=8009/tcp
sudo firewall-cmd --reload
sudo firewall-cmd --list-all
====