centos安装tomcat7.0.70

时间:2021-07-10 14:29:56

抄自:https://www.cnblogs.com/www1707/p/6592504.html

apache-tomcat-7.0.70
jdk-7u67-linux-x64

下载tomcat
http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.70/bin/apache-tomcat-7.0.70.tar.gz

下载jdk
http://download.oracle.com/otn/java/jdk/7u67-b01/jdk-7u67-linux-x64.tar.gz?AuthParam=1515815928_5144e4fac7ae6b8543b00030c43f4481

解压缩

#tar -zxvf apache-tomcat-7.0.70.tar.gz
#tar -zxvf jdk-7u67-linux-x64.tar.gz

拷贝到/usr/local/目录

#mv apache-tomcat-7.0.70 /usr/local/
#mv jdk1.7.0_67 /usr/local/src/

建立软链接

#cd /usr/local/
#ln -s /usr/local/src/jdk1.7.0_67 jdk
#ln -s /usr/local/apache-tomcat-7.0.70 tomcat

修改profile文件,追加内容

#vi /etc/profile
    JAVA_HOME=/usr/local/jdk
    CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
    export JAVA_HOME
    export PATH
    export CLASSPATH

#source /etc/profile
#java -version

安装jsvc

#cd /usr/local/tomcat/bin/
#tar -zxvf commons-daemon-native.tar.gz
#cd commons-daemon-1.0.15-native-src
#cd unix
#./configure --with-java=/usr/local/jdk
#make
#cp jsvc /usr/local/tomcat/bin/
#vi /usr/local/tomcat/bin/setenv.sh
    JAVA_HOME=/usr/local/jdk
    TOMCAT_USER=tomcat
    JSVC_OPTS='-jvm server'
    JAVA_OPTS=

建立tomcat用户运行tomcat

#useradd -s /sbin/nologin -M tomcat
#chown -R tomcat:tomcat /usr/local/tomcat
#ln -s /usr/local/tomcat/bin/daemon.sh /etc/init.d/tomcat
#vi /usr/local/tomcat/bin/daemon.sh
    # chkconfig: - 86 14
    # description: Tomcat7 daemon
    # processname: tomcat
#chkconfig --add tomcat
#service tomcat start