http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
http://tomcat.apache.org/download-80.cgi
2、解压文件 tar -zxvf xxxxxxxxxxxxx.gz
jdk放到 /usr/local/javajdk tomcat放到 /usr/local/tomcat
3、设置jdk环境变量
vi /etc/profile
#在底部添加
JAVA_HOME=/usr/local/javajdk
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar
export PATH JAVA_HOME CLASSPATH
source /etc/profile
4、启动tomcat
/usr/local/tomcat/bin/startup.sh
#/usr/local/tomcat/bin/shutdown.sh
firewall-cmd --zone=public --add-port=8080/tcp --permanent
sudo firewall-cmd --reload
5、设置开机自启动
如果要开机自启动tomcat,配置如下:
chmod +x /etc/rc.d/rc.local
-
vi /etc/rc.d/rc.local
export JAVA_HOME=/usr/local/javajdk
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar
/usr/local/tomcat/bin/startup.sh
(完)