sudo -i
安裝tomcat9
cd /www
wget http://ftp.mirror.tw/pub/apache/tomcat/tomcat-9/v9.0.7/bin/apache-tomcat-9.0.7.tar.gz
tar zxvf apache-tomcat-9.0.7.tar.gz
新增tomcat使用者及群組
groupadd tomcat useradd -s /bin/false -g tomcat -d /www/apache-tomcat-9.0.7 tomcat
修改tomcat目錄owner及group
chwon -hR tomcat.tomcat /www/apache-tomcat-9.0.7
安裝jre
cd /usr/java
wget https://www.oracle.com/paht/to/jre/for/jdk-XXX-linux-x64.tar.gz
tar zxvf jre-XXX-linux-x64.tar.gz
alternatives --install /usr/bin/java java /usr/java/jdkXXX/jre/bin/java 300
rm latest
ln -s /usr/java/jdkXXX latest
修改jre路徑
update-alternatives --config java
移除原來jre
sudo update-alternatives --remove java /usr/java/jdk_oldXXX/jre/bin/java
重建並移除無用soft link
cd /etc/alternatives
ln -sf /usr/java/jdkXXX/jre/bin/* .
ln -sf /usr/java/jdkXXX/bin/* .
ln -sf /usr/java/jdkXXX/man/man1/* .
find -xtype l -delete
修改 /etc/profile
-----------------
...
export JAVA_HOME=/usr/java/jdkXXX
export CATALINA_HOME=/apps/tomcat-x.x.x
-----------------
source /etc/profile
java -version
echo $JAVA_HOME
修改 /etc/systemd/system/multi-user.target.wants/tomcat.service
將 jre跟tomcat路徑改掉
=====================
# Systemd unit file for tomcat
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
#restart after failure
Restart=on-failure
RestartSec=5
TimeoutStartSec=60
TimeoutStopSec=60
export JAVA_HOME=/usr/java/jdk1.8.0_172
export CATALINA_HOME=/apps/tomcat-9.0.7
Environment=JAVA_HOME=/usr/java/jdk1.8.0_172
Environment=CATALINA_PID=/apps/tomcat-9.0.7/temp/tomcat.pid
Environment=CATALINA_HOME=/apps/tomcat-9.0.7
Environment=CATALINA_BASE=/apps/tomcat-9.0.7
Environment='CATALINA_OPTS=-Xms512M -Xmx4096M -server -XX:+UseParallelGC'
#Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'
ExecStart=/apps/tomcat-9.0.7/bin/startup.sh
ExecStop=/apps/tomcat-9.0.7/bin/shutdown.sh
#ExecStop=/bin/kill -15 $MAINPID
[Install]
WantedBy=multi-user.target
=====================
systemctl daemon-reload
=========
找出檔案的mod number
stat --format '%a' filename
找出有+s的檔案
find . -perm -4000
find . -perm -2000
ref:
沒有留言:
張貼留言