1.解压tomcat
tar zxvf apache-tomcat-7.0.
mv apache-tomcat-7.0.73 /usr/local/tomcat
2.解压jdk
tar zxvf
mv jdk1.8.0_111/ /usr/local/
3.设置环境变量vi /etc/profile
JAVA_HOME=/usr/local/jdk1.8.0_111
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export JAVA_HOME
export PATH
export CLASSPATH
4.使环境变量的设置生效source /etc/profile
5.启动测试
/usr/local/tomcat/bin/startup.sh
6.防火墙设置
iptables -t nat -I OUTPUT -p tcp --dport 8080 -j REDIRECT --to-ports 8080
iptables -t nat -I PREROUTING -p tcp --dport 8080 -j REDIRECT --to-ports 8080
iptables -F
/etc/rc.d/init.d/iptables save
7.设置启动项,配置服务.首先需要编译jsvc
复制一份/usr/local/tomcat/bin/
cp -rf /usr/local/tomcat/bin/ /usr/local/tomcat/bin/_bak
虚拟机linux安装jdk并解压
cd /usr/local/tomcat/bin
tar zxvf
到unix目录
cd commons-daemon-1.0.15-native-src/
cd unix/
yum install gcc
编译
./configure --with-java=/usr/local/jdk1.8.0_111/ make
如果报错执行make clean然后再执行make
生成了jsvc的二进制文件.复制到tomcat的bin目录
cp jsvc /usr/local/tomcat/bin/
编辑 vi /usr/local/tomcat/bin/setclasspath.sh
在开头加入
JAVA_HOME=/usr/local/jdk1.8.0_111
CATALINA_HOME=/usr/local/tomcat/
然后复制/usr/local/tomcat/bin/catalina.sh
cp /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat 编辑加入
vi /etc/init.d/tomcat
export JAVA_HOME=/usr/local/jdk1.8.0_111/
export CATALINA_HOME=/usr/local/tomcat/
添加服务成功.
/etc/init.d/tomcat stop && /etc/init.d/tomcat start
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论