您好,登錄后才能下訂單哦!
這篇文章主要介紹“Linux系統(tǒng)中JDK+Tomcat環(huán)境的安裝布署過(guò)程”,在日常操作中,相信很多人在Linux系統(tǒng)中JDK+Tomcat環(huán)境的安裝布署過(guò)程問(wèn)題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”Linux系統(tǒng)中JDK+Tomcat環(huán)境的安裝布署過(guò)程”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!
1、系統(tǒng)環(huán)境
[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、準(zhǔn)備需要安裝的軟件
apache-tomcat-8.0.39.tar.gz
jdk1.7.0_25.tar.gz
安裝apache服務(wù)請(qǐng)參考前面的章節(jié)
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需要的環(huán)境變量
[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
測(cè)試是否安裝成功
[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)
如果出現(xiàn)上述信息表明安裝成功
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
完成后會(huì)生成一個(gè)文件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
#
配置用戶與權(quán)限
[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、測(cè)試服務(wù)
啟動(dòng)服務(wù)
[root@centos6 unix]# /application/tomcat/bin/daemon.sh start
配置規(guī)范啟動(dòng)
[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
說(shuō)明配置是正確的,啟動(dòng)成功
到此,關(guān)于“Linux系統(tǒng)中JDK+Tomcat環(huán)境的安裝布署過(guò)程”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注億速云網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。