scp -rp -P52115 jdk-8u60-linux-x64.tar.gz root@192.168.1.204:/opt
scp -rp -P52115 apache-tomcat-9.0.0.M17.tar.gz root@192.168.1.204:/opt
tar xf /opt/jdk-8u60-linux-x64.tar.gz -C /usr/local/
ln -s /usr/local/jdk1.8.0_60/bin/java /sbin/java
sed -i.ori '$a export JAVA_HOME=/usr/local/jdk1.8.0_60\nexport PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH\nexportCLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar' /etc/profile
source /etc/profile
java -version
tar xf /opt/apache-tomcat-9.0.0.M17.tar.gz -C /usr/local/
ln -s /usr/local/apache-tomcat-9.0.0.M17/ /usr/local/tomcat9
echo 'export TOMCAT_HOME=/usr/local/tomcat9' >>/etc/profile
source /etc/profile
tail -5 /etc/profile
[root@localhost data]# tail -5 /etc/profile
unset -f pathmunge
export JAVA_HOME=/usr/local/jdk1.8.0_60
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
exportCLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
export TOMCAT_HOME=/usr/local/tomcat9
/usr/local/tomcat9/bin/startup.sh
/usr/local/tomcat9/bin/shutdown.sh
普通用户启动:
chown -R rusheng.rusheng /usr/local/jdk1.8.0_60/ /usr/local/tomcat9/