安裝tomcat整合jsvc、apr並配置為後台服務(作業系統CentOS x.x.x)

來源:互聯網
上載者:User

添加使用者
# groupadd xz_server
# useradd -g xz_server xz_lan
設定使用者口令為 4tomcat
# passwd xz_lan

安裝JDK
# cd /var/tomcat/res
# tar -zvxf jdk-7u5-linux-x64.tar.gz
mv jdk1.7.0_05 /var/tomcat/jdk1.7.0_05
# vi /etc/profile //在最後加上以下內容
JAVA_HOME=/var/tomcat/jdk1.7.0_05  
export JAVA_HOME   
CLASSPATH=/var/tomcat/jdk1.7.0_05/lib:/var/tomcat/jdk1.7.0_05/jre/lib:.   
export CLASSPATH  
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin   
export PATH   
JRE=/var/tomcat/jdk1.7.0_05/jre   
export JRE

安裝tomcat
# cd /var/tomcat/res
# tar -zvxf apache-tomcat-7.0.29.tar.gz
# mv apache-tomcat-7.0.29 /var/tomcat/tomcat

安裝jsvc
# cd /var/tomcat/tomcat/bin/                  //進入安裝目錄
# tar -zvxf commons-daemon-native.tar.gz                        //解壓
# cd commons-daemon-1.0.10-native-src/unix  //進入jsvc-src目錄
# autoconf
# ./configure --with-java=/var/tomcat/jdk1.7.0_05
# make

安裝APR
# cd /var/tomcat/res
# tar zxvf apr-1.3.8.tar.gz 
# cd apr-1.3.8
# chmod a+x configure
# ./configure --prefix=/var/tomcat/tomcat/apr
# make && make install

安裝APR-UTIL
# cd /var/tomcat/res
# tar zxvf apr-util-1.3.9.tar.gz
# cd apr-util-1.3.9
# ./configure --prefix=/var/tomcat/tomcat/apr-util --with-apr=/var/tomcat/tomcat/apr
# make && make install

編譯安裝Native
# cd /var/tomcat/tomcat/bin
# tar zxvf tomcat-native.tar.gz
# cd tomcat-native-1.1.24-src/jni/native
# ./configure --prefix=/var/tomcat/tomcat/apr --with-apr=/var/tomcat/tomcat/apr --with-java-home=/var/tomcat/jdk1.7.0_05
# make && make install

把tomcat_xz檔案複製到/etc/init.d目錄下換名為tomcat(見下一篇)

更改tomcat安裝目錄許可權
# chown -R xz_lan:xz_server /var/tomcat
# chown -R xz_lan:xz_server /var/tomcat/*

建立軟串連(開機自啟動)
# ln -s /etc/init.d/tomcat /etc/rc.d/rc3.d/K01tomcat
# ln -s /etc/init.d/tomcat /etc/rc.d/rc3.d/S99tomcat
# ln -s /etc/init.d/tomcat /etc/rc.d/rc5.d/K01tomcat
# ln -s /etc/init.d/tomcat /etc/rc.d/rc5.d/S99tomcat

或設定為後台服務
# /sbin/chkconfig --del tomcat
# /sbin/chkconfig --add tomcat
# /sbin/chkconfig --list tomcat

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.