Linux安装 tomcat
1、事先需要安装好JDK和nano
2、下载
wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.5.24/bin/apache-tomcat-8.5.24.tar.gz
3、 解压
tar -zxvf apache-tomcat-8.5.24.tar.gz
4、创建新目录存放Tomcat
mkdir /usr/local/tomcat
5、将解压后的移动到此处
mv apache-tomcat-8.5.24 /usr/local/tomcat/
6、 配置环境变量
export TOMCAT_HOME=/usr/local/tomcat/apache-tomcat-8.5.24
export CATALINA_HOME=/usr/local/tomcat/apache-tomcat-8.5.24/
export JRE_HOME=/usr/local/java/jdk1.8.0_152/jre
export JAVA_HOME=/usr/local/java/jdk1.8.0_152
7、修改端口号,找到 Connector port="8080" 修改成80
nano /usr/local/tomcat/apache-tomcat-8.5.24/conf/server.xml
8、启动,运行bin下的startup.sh
/usr/local/tomcat/apache-tomcat-8.5.24/bin/startup.sh
9、配置防火墙
nano /etc/sysconfig/iptables
补充上这三句
-A INPUT -m state –state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp --dport 6379 -j ACCEPT
最后重启防火墙/etc/init.d/iptables restart
10、浏览器输入【你的IP地址:80】出现tomcat页面代表连接成功