CentOS6.5 install tomcat7

CentOS6.5 install tomcat7


1. Download

# wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.29/bin/apache-tomcat-7.0.29.tar.gz 

2. Installation

# tar -xzvf apache-tomcat-7.0.29.tar.gz
# mv apache-tomcat-7.0.29 /opt/tomcat7 
# cd /opt/tomcat7 
# bin/startup.sh 

3. Configuration

It is not safe to use root in a production environment, so

# useradd -s /sbin/nologin tomcat 
# chown -R tomcat:tomcat /opt/tomcat7 

As a service, start with the operating system

# cd /opt/tomcat7/bin 
# tar -xzvf commons-daemon-native.tar.gz 
# cd commons-daemon-1.0.10-native-src/unix 
# ./configure 
# make 
# cp jsvc ../.. 
# cd ../.. 

After the comment of daemon.sh, the text starts with the following five lines

# vim daemon.sh
以下为需要输入的内容:
# chkconfig: 2345 10 90 
# description: Starts and Stops the Tomcat daemon. 
JAVA_HOME=/usr/java/jdk1.6.0_31 
CATALINA_HOME=/opt/tomcat7 CATALINA_OPTS="-Xms1024m -Xmx2048m -XX:PermSize=256m -XX:MaxPermSize=512m" 

add to service

# cp daemon.sh /etc/init.d/tomcat 
# chkconfig --add tomcat 

an examination

# chkconfig --list|grep tomcat 
tomcat 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭 

open port

# vim /etc/sysconfig/iptables 
输入以下内容:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT 
# service iptables restart 




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325990410&siteId=291194637