您好,登錄后才能下訂單哦!
這篇文章主要介紹“Linux系統中JDK+Tomcat環境的安裝布署過程”,在日常操作中,相信很多人在Linux系統中JDK+Tomcat環境的安裝布署過程問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”Linux系統中JDK+Tomcat環境的安裝布署過程”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
1、系統環境
[root@centos6 ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
[root@centos6 ~]# uname -r
2.6.32-431.el6.x86_64
Apache版本信息如下
[root@centos6 tomcat]# /application/apache/bin/apachectl -v
Server version: Apache/2.4.23 (Unix)
Server built: Nov 22 2016 13:15:17
2、準備需要安裝的軟件
apache-tomcat-8.0.39.tar.gz
jdk1.7.0_25.tar.gz
安裝apache服務請參考前面的章節
3、配置JKD
[root@centos6 tools]# tar zxf jdk1.7.0_25.tar.gz
[root@centos6 tools]# mv jdk1.7.0_25 /application/jdk
[root@centos6 tools]# ll /application/jdk
total 19724
drwxr-xr-x.210011001 4096 Jun 12 2015 bin
-r--r--r--. 1 1001 1001 3339 Jun 12 2015 COPYRIGHT
drwxr-xr-x. 4 1001 1001 4096 Jun 12 2015 db
drwxr-xr-x. 3 1001 1001 4096 Jun 12 2015 include
drwxr-xr-x. 5 1001 1001 4096 Jun 12 2015 jre
drwxr-xr-x. 3 1001 10014096 Jun 12 2015 lib
-r--r--r--. 1 1001 1001 40 Jun 12 2015 LICENSE
drwxr-xr-x. 5 10011001 4096 Jun 12 2015 man
-r--r--r--. 1 1001 1001 14 Jun 12 2015 README.html
-rw-r--r--. 1 1001 1001444 Jun 12 2015 release
-rw-r--r--. 1 1001 1001 19852231 Jun 12 2015 src.zip
-rw-r--r--. 1 1001 1001123324 Jun 12 2015 THIRDPARTYLICENSEREADME-JAVAFX.txt
-r--r--r--. 1 1001 1001 172252 Jun 12 2015 THIRDPARTYLICENSEREADME.txt
配置JDK需要的環境變量
[root@centos6 tools]# vi /etc/profile
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
在最后增加如下配置
JAVA_HOME=/application/jdk
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
[root@centos6 tools]# source /etc/profile
測試是否安裝成功
[root@centos6 tools]# java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
如果出現上述信息表明安裝成功
4、安裝配置tomcat
[root@centos6 tools]# tar zxf apache-tomcat-8.0.39.tar.gz
[root@centos6 tools]# mv apache-tomcat-8.0.39 /application/tomcat
[root@centos6 tools]# cd /application/tomcat/
[root@centos6 tomcat]# cd bin/
[root@centos6 bin]# tar zxf commons-daemon-native.tar.gz
[root@centos6 bin]# cd commons-daemon-1.0.15-native-src/unix/
[root@centos6 unix]# ./configure --with-java=/application/jdk
*** Writing output files ***
configure: creating ./config.status
config.status: creating Makefile
config.status: creating Makedefs
config.status: creating native/Makefile
*** All done ***
Now you can issue "make"
[root@centos6 unix]# make
完成后會生成一個文件jsvc
[root@centos6 unix]# ll jsvc
-rwxr-xr-x. 1 root root 143689 Nov 27 20:49 jsvc
將jsvc文件拷貝至/tomcat/bin目錄下
[root@centos6 unix]# cp jsvc /application/tomcat/bin/
[root@centos6 unix]# ll /application/tomcat/bin/jsvc
-rwxr-xr-x. 1 root root 143689 Nov 27 20:50 /application/tomcat/bin/jsvc
配置daemon.sh
test".$TOMCAT_USER" = . && TOMCAT_USER=tomcat
# Set JAVA_HOME toworking JDK or JRE
#JAVA_HOME=/opt/jdk-1.6.0.22
# If not set we'lltry to guess the JAVA_HOME
# from java binaryif on the PATH
#
<-------修改如下---->
test".$TOMCAT_USER" = . && TOMCAT_USER=tomcat
# Set JAVA_HOME toworking JDK or JRE
JAVA_HOME=/application/jdk
# If not set we'lltry to guess the JAVA_HOME
# from java binaryif on the PATH
#
配置用戶與權限
[root@centos6 unix]# useradd tomcat -M -s /sbin/nologin
[root@centos6 unix]# chown -R tomcat /application/tomcat
[root@centos6 unix]# chmod +x /application/tomcat/bin/*.sh
5、測試服務
啟動服務
[root@centos6 unix]# /application/tomcat/bin/daemon.sh start
配置規范啟動
[root@centos6 unix]# ln -s /application/tomcat/bin/daemon.sh /etc/init.d/tomcat
[root@centos6 unix]# chmod +x /etc/init.d/tomcat
[root@centos6 unix]# /etc/init.d/tomcat stop
[root@centos6 unix]# /etc/init.d/tomcat start
[root@centos6 unix]# /etc/init.d/tomcat stop
[root@centos6 unix]# ps -ef|grep tomcat|grep -v grep|wc -l
0
[root@centos6 unix]# /etc/init.d/tomcat start
[root@centos6 unix]# ps -ef|grep tomcat|grep -v grep|wc -l
2
說明配置是正確的,啟動成功
到此,關于“Linux系統中JDK+Tomcat環境的安裝布署過程”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。