溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Tomcat部署實(shí)戰(zhàn)!

發(fā)布時(shí)間:2020-07-19 00:31:18 來(lái)源:網(wǎng)絡(luò) 閱讀:623 作者:JarryZ 欄目:云計(jì)算

Tomcat部署及優(yōu)化

1.Tomcat安裝部署

2.虛擬主機(jī)配置

3.Tomcat優(yōu)化

Tomcat介紹

1.免費(fèi)的、開(kāi)放源代碼的Web應(yīng)用服務(wù)器
2.Apache軟件基金會(huì)(Apache Software Foundation)Jakarta項(xiàng)目中的- -個(gè)核心項(xiàng)目
3.由Apache、 Sun和一些公司及個(gè)人共同開(kāi)發(fā)而成
4.深受Java愛(ài)好者的喜愛(ài),并得到部分軟件開(kāi)發(fā)商的認(rèn)可
5.目前比較流行的Web應(yīng)用服務(wù)器

Tomcat部署步驟

1.下載并安裝jdk

2.安裝并啟動(dòng)Tomcat

3.配置虛擬主機(jī)

設(shè)置環(huán)境變量

1.編輯/etc/profile文件:

export JAVA_HOME=/usr/java/jdk1.8.0_171-amd64

export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt,jar

export PATH=$JAVA_HOME/bin:$PATH

2.使環(huán)境變量生效的命令:

[root@localhost~]#source /etc/profile

3.查看jdk版本的命令:

[root@localhost~]#java -version

安裝、啟動(dòng)Tomcat

1.下載安裝包:

[root@localhost ~]# wget http://mirrors. shu.edu.cn/apache/tomcat/tomcat-9/v9.0.8/bin/apache-tomcat-9.0.8.tar.gz

2.將安裝包移動(dòng)到/usr/local下重命名:

[root@localhost ~]# mv apache-tomcat-9.0.8 /usr/ocal/tomcat

3.啟動(dòng)Tomcat:

[root@localhost ~]# /usr/local/tomcat/bin/startup.sh

Tomcat啟動(dòng)時(shí)間

1.縮短啟動(dòng)時(shí)間的命令
/usr/java/jdk1.8.0_171-amd64/je/lib/security/java.security文件

securerandom.source=file:/dev/random改為urandom

Demo:Tomcat安裝

[root@localhost ~]# mkdir /aaa
[root@localhost ~]# mount.cifs //192.168.10.139/rpm /aaa
Password for root@//192.168.10.139/rpm:  
[root@localhost ~]# cd /aaa
[root@localhost aaa]# ls
amoeba-mysql-binary-2.2.0.tar.gz  lf.jpg
apr-1.6.2.tar.gz                  mysql-5.5.24.tar.gz
apr-util-1.6.0.tar.gz             mysql-5.6.26.tar.gz
httpd-2.4.29.tar.bz2              TC
[root@localhost aaa]# cd TC/
[root@localhost TC]# ls
apache-jmeter-5.1
apache-jmeter-5.1.zip
apache-tomcat-9.0.16.tar.gz
jdk-8u201-linux-x64.rpm
[root@localhost TC]# rpm -ivh jdk-8u201-linux-x64.rpm 
[root@localhost TC]# cd /usr/java/
[root@localhost java]# ls
default  jdk1.8.0_201-amd64  latest
[root@localhost java]# cd jdk1.8.0_201-amd64/
[root@localhost jdk1.8.0_201-amd64]# ls
bin             man
COPYRIGHT       README.html
include         release
javafx-src.zip  src.zip
jre             THIRDPARTYLICENSEREADME-JAVAFX.txt
lib             THIRDPARTYLICENSEREADME.txt
LICENSE

//設(shè)置環(huán)境變量:
[root@localhost jdk1.8.0_201-amd64]# vim /etc/profile
按大寫(xiě)字母G到末行,按小寫(xiě)字母o在下行插入以下內(nèi)容:
export JAVA_HOME=/usr/java/jdk1.8.0_201-amd64
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH=$JAVA_HOME/bin:$PATH
//修改完成后,按Esc退出插入模式,輸入:wq保存退出
[root@localhost jdk1.8.0_201-amd64]# source /etc/profile
[root@localhost jdk1.8.0_201-amd64]# java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
[root@localhost jdk1.8.0_201-amd64]# cd /aaa
[root@localhost aaa]# ls
Discuz_X3.4_SC_UTF8.zip           nginx-1.12.2.tar.gz
error.png                         php-7.1.10.tar.bz2
extundelete-0.2.4.tar.bz2         php-7.1.20.tar.gz
httpd-2.4.29.tar.bz2              TC
[root@localhost aaa]# cd TC/
[root@localhost TC]# ls
apache-jmeter-5.1
apache-jmeter-5.1.zip
apache-tomcat-9.0.16.tar.gz
jdk-8u201-linux-x64.rpm
[root@localhost TC]# tar zxvf apache-tomcat-9.0.16.tar.gz -C /usr/local/
[root@localhost TC]# cd /usr/local/
[root@localhost local]# ls
apache-tomcat-9.0.16  etc    include  lib64    sbin   src
bin                   games  lib      libexec  share
//為方便后面查找,修改文件夾名
[root@localhost local]# mv apache-tomcat-9.0.16/ tomcat
[root@localhost local]# ls
bin  games    lib    libexec  share  tomcat
etc  include  lib64  sbin     src
[root@localhost local]# cd tomcat/
[root@localhost tomcat]# cd bin/
[root@localhost bin]# ls
bootstrap.jar                 makebase.sh
catalina.bat                  setclasspath.bat
catalina.sh                   setclasspath.sh
catalina-tasks.xml            shutdown.bat
ciphers.bat                   shutdown.sh
ciphers.sh                    startup.bat
commons-daemon.jar            startup.sh
commons-daemon-native.tar.gz  tomcat-juli.jar
configtest.bat                tomcat-native.tar.gz
configtest.sh                 tool-wrapper.bat
daemon.sh                     tool-wrapper.sh
digest.bat                    version.bat
digest.sh                     version.sh
makebase.bat
[root@localhost bin]# ln -s /usr/local/tomcat/bin/startup.sh /usr/bin/
[root@localhost bin]# ln -s /usr/local/tomcat/bin/shutdown.sh /usr/bin/
[root@localhost bin]# systemctl stop firewalld.service 
[root@localhost bin]# setenforce 0
[root@localhost bin]# startup.sh 
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/java/jdk1.8.0_201-amd64
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.

此時(shí)使用宿主機(jī)瀏覽器輸入地址:192.168.18.145:8080,可訪問(wèn)到Tomcat的主頁(yè):

Tomcat部署實(shí)戰(zhàn)!

此時(shí)Tmocat部署成功,謝謝觀看!

向AI問(wèn)一下細(xì)節(jié)

免責(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)容。

AI