[root@localhost ~]# mount.cifs //192.168.100.10/tomcat /mnt //將存有tomcat的工具掛載到mnt目錄
Password for root@//192.168.100.10/tomcat:
[root@localhost ~]# cd /mnt //進(jìn)入mnt目錄
[root@localhost mnt]# ls //查看是否成功掛載
12D18CFCD6599AFF0445766ACC4CA231C5025773.torrent apache-tomcat-9.0.16.tar.gz
apache-jmeter-5.1 jdk-8u201-linux-x64.rpm
apache-jmeter-5.1.zip tomcat優(yōu)化壓測(cè).jmx
[root@localhost mnt]# rpm -ivh jdk-8u201-linux-x64.rpm //安裝jdk包
警告:jdk-8u201-linux-x64.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID ec551f03: NOKEY
準(zhǔn)備中... ################################# [100%]
正在升級(jí)/安裝...
1:jdk1.8-2000:1.8.0_201-fcs ################################# [100%]
Unpacking JAR files...
tools.jar...
plugin.jar...
javaws.jar...
deploy.jar...
rt.jar...
jsse.jar...
charsets.jar...
localedata.jar...
[root@localhost mnt]# cd /usr/java/ //進(jìn)入Java安裝目錄
[root@localhost java]# ls
default jdk1.8.0_201-amd64 latest
[root@localhost java]# cd jdk1.8.0_201-amd64/ //進(jìn)入jdk目錄
[root@localhost jdk1.8.0_201-amd64]# ls
bin jre README.html THIRDPARTYLICENSEREADME.txt
COPYRIGHT lib release
include LICENSE src.zip
javafx-src.zip man THIRDPARTYLICENSEREADME-JAVAFX.txt
[root@localhost jdk1.8.0_201-amd64]# pwd //查看當(dāng)前位置
/usr/java/jdk1.8.0_201-amd64 //復(fù)制此條目
[root@localhost jdk1.8.0_201-amd64]# vim /etc/profile //編輯profile文件進(jìn)行參數(shù)更新
export JAVA_HOME=/usr/java/jdk1.8.0_201-amd64 //聲明變量位置
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar //聲明CLASS變量
export PATH=$JAVA_HOME/bin:$PATH //聲明環(huán)境變量
:qw
[root@localhost jdk1.8.0_201-amd64]# source /etc/profile //執(zhí)行profile文件
[root@localhost jdk1.8.0_201-amd64]# java -version //查看Java版本,測(cè)試Java是否安裝成功
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 /mnt
[root@localhost mnt]# ls
12D18CFCD6599AFF0445766ACC4CA231C5025773.torrent apache-tomcat-9.0.16.tar.gz
apache-jmeter-5.1 jdk-8u201-linux-x64.rpm
apache-jmeter-5.1.zip tomcat優(yōu)化壓測(cè).jmx
[root@localhost mnt]# tar zxvf apache-tomcat-9.0.16.tar.gz -C /usr/local/ //解壓tomcat文件到/usr/local目錄
[root@localhost mnt]# cd /usr/local/
[root@localhost local]# ls
apache-tomcat-9.0.16 bin etc games include lib lib64 libexec sbin share src
[root@localhost local]# mv apache-tomcat-9.0.16/ tomcat //將文件更名
[root@localhost local]# cd tomcat/ //進(jìn)入tomcat目錄
[root@localhost tomcat]# ls
bin conf lib logs README.md RUNNING.txt webapps
BUILDING.txt CONTRIBUTING.md LICENSE NOTICE RELEASE-NOTES temp work
[root@localhost tomcat]# cd bin //進(jìn)入命令存放目錄
[root@localhost bin]# ls
bootstrap.jar commons-daemon-native.tar.gz makebase.sh tomcat-juli.jar
catalina.bat configtest.bat setclasspath.bat tomcat-native.tar.gz
catalina.sh configtest.sh setclasspath.sh tool-wrapper.bat
catalina-tasks.xml daemon.sh shutdown.bat tool-wrapper.sh
ciphers.bat digest.bat shutdown.sh version.bat
ciphers.sh digest.sh startup.bat version.sh
commons-daemon.jar makebase.bat startup.sh
[root@localhost bin]# ln -s /usr/local/tomcat/bin/startup.sh /usr/bin/ //將軟件啟動(dòng)腳本建立軟連接到系統(tǒng)命令目錄下
[root@localhost bin]# ln -s /usr/local/tomcat/bin/shutdown.sh /usr/bin/ //將關(guān)閉軟件腳本建立軟連接到系統(tǒng)命令目錄下
[root@localhost bin]# systemctl stop firewalld.service //關(guān)閉防火墻
[root@localhost bin]# setenforce 0 //關(guān)閉增強(qiáng)性安全功能
[root@localhost bin]# startup.sh //使用命令啟動(dòng)tomcat服務(wù)(可以使用TAB鍵補(bǔ)全哦)
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.
[root@localhost bin]# netstat -ntap | grep 8080 //使用命令查看端口是否開(kāi)啟
tcp6 0 0 :::8080 :::* LISTEN 3137/java
[root@localhost bin]# shutdown.sh //關(guān)閉軟件
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.j
[root@localhost security]# cd /usr/java/jdk1.8.0_201-amd64/jre/lib/security/ //進(jìn)入Java目錄
[root@localhost security]# vim java.security //修改jdk參數(shù),優(yōu)化tomcat啟動(dòng)速度
...//省略部分內(nèi)容...
# In addition, if "file:/dev/random" or "file:/dev/urandom" is
# specified, the "NativePRNG" implementation will be more preferred than
# SHA1PRNG in the Sun provider.
#
securerandom.source=file:/dev/urandom //random更改為urandom優(yōu)化tomcat啟動(dòng)速度
...//省略部分內(nèi)容...
:wq
[root@localhost security]# startup.sh //再次啟動(dòng),啟動(dòng)速度加快
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.
[root@localhost security]# yum install -y bind //安裝DNSfuwu
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
...//省略部分內(nèi)容...
Installed:
bind.x86_64 32:9.11.4-9.P2.el7
...//省略部分內(nèi)容...
Complete!
[root@localhost conf]# vim /etc/named.conf //編輯修改DNS服務(wù)主配置文件
...//省略部分內(nèi)容...
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { any; };
...//省略部分內(nèi)容...
:wq
[root@localhost conf]# vim /etc/named.rfc1912.zones //編輯修改DNS服務(wù)區(qū)域配置文件
...//省略部分內(nèi)容...
zone "kgc.com" IN {
type master;
file "kgc.com.zone";
allow-update { none; };
};
...//省略部分內(nèi)容...
:wq
[root@localhost conf]# cd /var/named/ //進(jìn)入DNS服務(wù)區(qū)域數(shù)據(jù)文件存放目錄
[root@localhost named]# cp -p named.localhost kgc.com.zone //復(fù)制區(qū)域數(shù)據(jù)文件模板
[root@localhost named]# vim kgc.com.zone //編輯修改DNS服務(wù)區(qū)域數(shù)據(jù)配置文件
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 127.0.0.1
www IN A 192.168.144.133
:wq
[root@localhost named]# systemctl start named //啟動(dòng)DNS服務(wù)
[root@localhost conf]# vim /etc/named.rfc1912.zones //編輯DNS服務(wù)區(qū)域配置文件
...//省略部分內(nèi)容...
zone "kgc.com" IN {
type master;
file "kgc.com.zone";
allow-update { none; };
};
zone "accp.com" IN {
type master;
file "accp.com.zone";
allow-update { none; };
};
...//省略部分內(nèi)容...
:wq
[root@localhost conf]# cd /var/named/ //進(jìn)入?yún)^(qū)域數(shù)據(jù)文件目錄
[root@localhost named]# cp -p kgc.com.zone accp.com.zone //復(fù)制DNS服務(wù)區(qū)域數(shù)據(jù)配置文件
[root@localhost named]# systemctl restart named //重啟DNS服務(wù)
[root@localhost named]# cd ~
[root@localhost ~]# cd /usr/local/tomcat/ //進(jìn)入tomcat目錄文件
[root@localhost tomcat]# ls
bin conf lib logs README.md RUNNING.txt webapps
BUILDING.txt CONTRIBUTING.md LICENSE NOTICE RELEASE-NOTES temp work
[root@localhost tomcat]# cd webapps/ //進(jìn)入服務(wù)網(wǎng)頁(yè)站點(diǎn)
[root@localhost webapps]# ls
docs examples host-manager manager ROOT
[root@localhost webapps]# mkdir kgc //創(chuàng)建目錄
[root@localhost webapps]# echo "this is kgc web" > kgc/index.jsp //編輯主頁(yè)文件
[root@localhost webapps]# mkdir accp //創(chuàng)建目錄
[root@localhost webapps]# echo "this is accp web" > accp/index.jsp //編輯主頁(yè)文件
[root@localhost webapps]# tree accp/ kgc/ //使用命令以樹(shù)形結(jié)構(gòu)查看目錄
accp/
└── index.jsp
kgc/
└── index.jsp
[root@localhost webapps]# cd ../conf/ //進(jìn)入tomcat配置文件存放目錄
[root@localhost conf]# ls
Catalina catalina.properties jaspic-providers.xml logging.properties tomcat-users.xml web.xml
catalina.policy context.xml jaspic-providers.xsd server.xml tomcat-users.xsd
[root@localhost conf]# vim server.xml //編輯配置文件,編輯虛擬主機(jī)配置
...//省略部分內(nèi)容...
<Host name="www.accp.com" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context docBase="/usr/local/tomcat/webapps/accp" path="" reloadable="true"/>
</Host>
<Host name="www.kgc.com" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context docBase="/usr/local/tomcat/webapps/kgc" path="" reloadable="true"/>
</Host>
...//省略部分內(nèi)容...
:wq
[root@localhost conf]# shutdown.sh //關(guān)閉tomcat服務(wù)
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
[root@localhost conf]# startup.sh //啟動(dòng)tomcat服務(wù)
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.
【noCompressionUserAgents="gozilla, traviata"】對(duì)于以下的瀏覽器,不啟用壓縮
[root@localhost conf]# vim server.xml //編輯tomcat配置文件
...//省略部分內(nèi)容...
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
minSpareThreads="50"
enableLookups="false" //添加優(yōu)化條目
disableUploadTimeout="true"
acceptCount="300"
maxThreads="500"
processorCache="500"
URIEncoding="UTF-8"
compression="on"
compressionMinSize="2048"
compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain,image/gif,image /jpg,image/png"/>
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
...//省略部分內(nèi)容...
:wq
[root@localhost conf]# shutdown.sh //停止服務(wù)
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
[root@localhost conf]# startup.sh //啟動(dòng)服務(wù)
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.
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線(xiàn),公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性?xún)r(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿(mǎn)足用戶(hù)豐富、多元化的應(yīng)用場(chǎng)景需求。
當(dāng)前文章:詳述Linux系統(tǒng)中Tomcat部署及優(yōu)化-創(chuàng)新互聯(lián)
文章URL:http://m.rwnh.cn/article32/djijsc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)、網(wǎng)站制作、標(biāo)簽優(yōu)化、手機(jī)網(wǎng)站建設(shè)、微信公眾號(hào)、網(wǎng)頁(yè)設(shè)計(jì)公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容