JDK+Tomcat+Jenkins部署
阿新 • • 發佈:2018-04-08
jdk Tomcat Jenkins 1.Tomcat簡介
Tomcat是Apache軟件基金會(Apache Software Foundation)的Jakarta 項目中的一個核心項目,由Apache、Sun和其他一些公司及個人共同開發而成。
Tomcat服務器是一個免費的開放源代碼的Web應用服務器,屬於輕量級應用服務器,在中小型系統和並發訪問用戶不是很多的場合下被普遍使用,是開發和調試
JSP程序的首選。
Tomcat和Nginx、Apache(httpd)、lighttpd等Web服務器一樣,具有處理HTML頁面的功能,另外它還是一個Servlet和JSP容器,獨立的Servlet容器是
Tomcat的默認模式。不過,Tomcat處理靜態HTML的能力不如Nginx/Apache服務器。
2.Tomcat安裝
2.1軟件準備
JDK下載:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Tomcat下載:http://tomcat.apache.org/
Jenkins下載:https://jenkins.io/index.html
2.2 部署java和tomcat環境
2.2.1將下載的jdk和tomcat源碼包解壓到/usr/local/include/下
tar -zxvf apache-tomcat-8.0.27.tar.gz -C /usr/local/include/tomcat8 #同理解壓JDK
2.2.2在/etc/profile末尾添加如下代碼,修改完後執行source /etc/profile,使配置文件立即生效
export JAVA_HOME=/usr/local/include/jdk/
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export TOMCAT_HOME=/usr/local/include/tomcat8/
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
2.3 Tomcat目錄介紹
.
├── bin #→用以啟動、關閉Tomcat或者其它功能的腳本(.bat文件和.sh文件)
├── conf #→用以配置Tomcat的XML及DTD文件
├── lib #→存放web應用能訪問的JAR包
├── LICENSE
├── logs #→Catalina和其它Web應用程序的日誌文件
├── NOTICE
├── RELEASE-NOTES
├── RUNNING.txt
├── temp #→臨時文件
├── webapps #→Web應用程序根目錄
└── work #→用以產生有JSP編譯出的Servlet的.java和.class文件
7 directories, 4 files
2.4 webapps目錄結構
[root@tomcat tomcat]# cd webapps/
[root@tomcat webapps]# ll
total 20
drwxr-xr-x 14 root root 4096 Oct 5 12:09 docs #→tomcat幫助文檔
drwxr-xr-x 6 root root 4096 Oct 5 12:09 examples #→web應用實例
drwxr-xr-x 5 root root 4096 Oct 5 12:09 host-manager #→管理
drwxr-xr-x 5 root root 4096 Oct 5 12:09 manager #→管理
drwxr-xr-x 3 root root 4096 Oct 5 12:09 ROOT #→默認網站根目錄
2.5 啟動Tomcat(也可直接使用/usr/local/include/tomcat8/bin/catalina.sh start|stop)
啟動程序: /usr/local/include/tomcat8/bin/startup.sh
關閉程序: /usr/local/include/tomcat8/bin/shutdown.sh
[root@tomcat ~]# /application/tomcat/bin/startup.sh
Using CATALINA_BASE: /application/tomcat
Using CATALINA_HOME: /application/tomcat
Using CATALINA_TMPDIR: /application/tomcat/temp
Using JRE_HOME: /application/jdk
Using CLASSPATH: /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar
Tomcat started.
查看監聽端口
[root@tomcat01 tomcat8]# netstat -tunlp|grep java
tcp 0 0 :::8009 :::* LISTEN 1914/java
tcp 0 0 :::80 :::* LISTEN 1914/java
查看進程
[root@tomcat01 tomcat8]# ps -ef|grep java
root 1914 1 13 23:08 pts/0 00:00:19 /usr/local/include/jdk//bin/java -Djava.util.logging.config.file=/usr/local/include/tomcat8//conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -classpath /usr/local/include/tomcat8//bin/bootstrap.jar:/usr/local/include/tomcat8//bin/tomcat-juli.jar -Dcatalina.base=/usr/local/include/tomcat8/ -Dcatalina.home=/usr/local/include/tomcat8/ -Djava.io.tmpdir=/usr/local/include/tomcat8//temp org.apache.catalina.startup.Bootstrap start
2.6 訪問網站
網址:http://192.168.100.81:8080/ #服務器IP地址
2.7 Tomcat日誌
tomcat實時日誌查看
[root@tomcat01 tomcat8]# tailf /usr/local/include/tomcat8/logs/catalina.out
22-Apr-2017 23:08:29.659 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/include/tomcat8/webapps/host-manager has finished in 44 ms
22-Apr-2017 23:08:29.663 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/include/tomcat8/webapps/ROOT
22-Apr-2017 23:08:29.690 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/include/tomcat8/webapps/ROOT has finished in 27 ms
22-Apr-2017 23:08:29.691 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/include/tomcat8/webapps/examples
22-Apr-2017 23:08:29.954 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/include/tomcat8/webapps/examples has finished in 259 ms
22-Apr-2017 23:08:29.955 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/include/tomcat8/webapps/manager
22-Apr-2017 23:08:29.982 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/include/tomcat8/webapps/manager has finished in 27 ms
22-Apr-2017 23:08:29.990 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-80"]
22-Apr-2017 23:08:30.019 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
22-Apr-2017 23:08:30.036 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 26300 ms
3.Tomcat配置文件
3.1 Tomcat配置文件介紹
[root@tomcat01 tomcat8]# ll /usr/local/include/tomcat8/conf/
total 228
drwxr-x--- 3 root root 4096 Apr 22 15:00 Catalina
-rwxr-xr-x 1 root root 12895 Apr 13 20:58 catalina.policy
-rwxr-xr-x 1 root root 7376 Apr 13 20:58 catalina.properties
-rwxr-xr-x 1 root root 1338 Apr 22 21:41 context.xml
-rwxr-xr-x 1 root root 1149 Apr 13 20:58 jaspic-providers.xml
-rwxr-xr-x 1 root root 2358 Apr 13 20:58 jaspic-providers.xsd
-rwxr-xr-x 1 root root 3622 Apr 13 20:58 logging.properties
-rwxr-xr-x 1 root root 7509 Apr 22 15:05 server.xml #→主配置文件
-rwxr-xr-x 1 root root 2298 Apr 22 22:10 tomcat-users.xml #→Tomcat管理用戶配置文件
-rwxr-xr-x 1 root root 2633 Apr 13 20:58 tomcat-users.xsd
-rwxr-xr-x 1 root root 168133 Apr 13 20:58 web.xml
3.2 Tomcat配置管理界面(註意:測試功能,生產環境不要用。)
Tomcat管理功能用於對Tomcat自身以及部署在Tomcat上的應用進行管理的web應用。在默認情況下是處於禁用狀態的。如果需要開啟這個功能,就需要配置管理用戶,即配置上面提到的tomcat-users.xml。
配置tomcat-users.xml文件
[root@tomcat01 tomcat8]# vim /usr/local/include/tomcat8/conf/tomcat-users.xml
…………
<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
<role rolename="manager-status"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<user username="tomcatadmin" password="Foxconn99" roles="admin-gui,manager-gui,manager-status,manager-script,manager-jmx" />
</tomcat-users> #在此行前加入上面六行
配置完後,重新啟動tomcat服務生效
[root@tomcat ~]# /usr/local/include/tomcat8/bin/shutdown.sh
[root@tomcat ~]# /usr/local/include/tomcat8/bin/startup.sh
配置context.xml文件
[root@tomcat02 conf]# find / -name context.xml
/usr/local/include/tomcat8/webapps/host-manager/META-INF/context.xml #修改訪問IP列表
/usr/local/include/tomcat8/webapps/manager/META-INF/context.xml #修改訪問IP列表
/usr/local/include/tomcat8/conf/context.xml #此處不用修改
修改/usr/local/include/tomcat8/webapps/host-manager/META-INF/context.xml,添加“192.\d+.\d+.\d+”代表可遠程訪問該服務器的IP地址段,192...*(此處註意正則表達式)
[root@tomcat02 conf]# vim /usr/local/include/tomcat8/webapps/host-manager/META-INF/context.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context antiResourceLocking="false" privileged="true" >
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1|192\.\d+\.\d+\.\d+" />
</Context>
修改/usr/local/include/tomcat8/webapps/host-manager/META-INF/context.xml,添加“192.\d+.\d+.\d+”代表可遠程訪問該服務器的IP地址段,192...*(此處註意正則表達式)
[root@tomcat02 conf]# vim /usr/local/include/tomcat8/webapps/manager/META-INF/context.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context antiResourceLocking="false" privileged="true" >
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1|192\.\d+\.\d+\.\d+" />
</Context>
重新啟動tomcat服務
[root@tomcat02 conf]# /usr/local/include/tomcat8/bin/catalina.sh stop
Using CATALINA_BASE: /usr/local/include/tomcat8
Using CATALINA_HOME: /usr/local/include/tomcat8
Using CATALINA_TMPDIR: /usr/local/include/tomcat8/temp
Using JRE_HOME: /usr/local/include/jdk/
Using CLASSPATH: /usr/local/include/tomcat8/bin/bootstrap.jar:/usr/local/include/tomcat8/bin/tomcat-juli.jar
[root@tomcat02 conf]# /usr/local/include/tomcat8/bin/catalina.sh start
Using CATALINA_BASE: /usr/local/include/tomcat8
Using CATALINA_HOME: /usr/local/include/tomcat8
Using CATALINA_TMPDIR: /usr/local/include/tomcat8/temp
Using JRE_HOME: /usr/local/include/jdk/
Using CLASSPATH: /usr/local/include/tomcat8/bin/bootstrap.jar:/usr/local/include/tomcat8/bin/tomcat-juli.jar
Tomcat started.
此時可以就可以正常開啟tomcat的Manager App、Host Manager、Server Status等頁面
4.在Tomcat上部署Jenkins系統
4.1將下載好的Jenkins的war包放在/data/www/jenkins/文件夾下面
[root@tomcat02 jenkins]# pwd
/data/www/jenkins
[root@tomcat02 jenkins]# ll
total 67064
-rwxrwxrwx 1 root root 68669812 Apr 11 21:32 jenkins.war
4.2在/usr/local/include/tomcat8/conf/Catalina/localhost/目錄下面新建一個名為jenkins.xml的文件。
文件內容如下:
<Context path="jenkins" docBase="/data/www/jenkins/jenkins.war" />
註意:實際上jenkins的war包直接復制到/usr/local/include/tomcat8/webapps/下,就會自動解壓,在webapps目錄下面自動生成jenkins目錄。而且,在發布war包的應用程式時,最好提前停止Tomcat服務。
Tomcat是Apache軟件基金會(Apache Software Foundation)的Jakarta 項目中的一個核心項目,由Apache、Sun和其他一些公司及個人共同開發而成。
Tomcat服務器是一個免費的開放源代碼的Web應用服務器,屬於輕量級應用服務器,在中小型系統和並發訪問用戶不是很多的場合下被普遍使用,是開發和調試
JSP程序的首選。
Tomcat和Nginx、Apache(httpd)、lighttpd等Web服務器一樣,具有處理HTML頁面的功能,另外它還是一個Servlet和JSP容器,獨立的Servlet容器是
Tomcat的默認模式。不過,Tomcat處理靜態HTML的能力不如Nginx/Apache服務器。
2.Tomcat安裝
2.1軟件準備
JDK下載:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Tomcat下載:http://tomcat.apache.org/
Jenkins下載:https://jenkins.io/index.html
2.2 部署java和tomcat環境
2.2.1將下載的jdk和tomcat源碼包解壓到/usr/local/include/下
tar -zxvf apache-tomcat-8.0.27.tar.gz -C /usr/local/include/tomcat8
2.2.2在/etc/profile末尾添加如下代碼,修改完後執行source /etc/profile,使配置文件立即生效
export JAVA_HOME=/usr/local/include/jdk/
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export TOMCAT_HOME=/usr/local/include/tomcat8/
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
2.3 Tomcat目錄介紹
.
├── bin #→用以啟動、關閉Tomcat或者其它功能的腳本(.bat文件和.sh文件)
├── conf #→用以配置Tomcat的XML及DTD文件
├── lib #→存放web應用能訪問的JAR包
├── LICENSE
├── logs #→Catalina和其它Web應用程序的日誌文件
├── NOTICE
├── RELEASE-NOTES
├── RUNNING.txt
├── temp #→臨時文件
├── webapps #→Web應用程序根目錄
└── work #→用以產生有JSP編譯出的Servlet的.java和.class文件
7 directories, 4 files
2.4 webapps目錄結構
[root@tomcat tomcat]# cd webapps/
[root@tomcat webapps]# ll
total 20
drwxr-xr-x 14 root root 4096 Oct 5 12:09 docs #→tomcat幫助文檔
drwxr-xr-x 6 root root 4096 Oct 5 12:09 examples #→web應用實例
drwxr-xr-x 5 root root 4096 Oct 5 12:09 host-manager #→管理
drwxr-xr-x 5 root root 4096 Oct 5 12:09 manager #→管理
drwxr-xr-x 3 root root 4096 Oct 5 12:09 ROOT #→默認網站根目錄
2.5 啟動Tomcat(也可直接使用/usr/local/include/tomcat8/bin/catalina.sh start|stop)
啟動程序: /usr/local/include/tomcat8/bin/startup.sh
關閉程序: /usr/local/include/tomcat8/bin/shutdown.sh
[root@tomcat ~]# /application/tomcat/bin/startup.sh
Using CATALINA_BASE: /application/tomcat
Using CATALINA_HOME: /application/tomcat
Using CATALINA_TMPDIR: /application/tomcat/temp
Using JRE_HOME: /application/jdk
Using CLASSPATH: /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar
Tomcat started.
查看監聽端口
[root@tomcat01 tomcat8]# netstat -tunlp|grep java
tcp 0 0 :::8009 :::* LISTEN 1914/java
tcp 0 0 :::80 :::* LISTEN 1914/java
查看進程
[root@tomcat01 tomcat8]# ps -ef|grep java
root 1914 1 13 23:08 pts/0 00:00:19 /usr/local/include/jdk//bin/java -Djava.util.logging.config.file=/usr/local/include/tomcat8//conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -classpath /usr/local/include/tomcat8//bin/bootstrap.jar:/usr/local/include/tomcat8//bin/tomcat-juli.jar -Dcatalina.base=/usr/local/include/tomcat8/ -Dcatalina.home=/usr/local/include/tomcat8/ -Djava.io.tmpdir=/usr/local/include/tomcat8//temp org.apache.catalina.startup.Bootstrap start
2.6 訪問網站
網址:http://192.168.100.81:8080/ #服務器IP地址
2.7 Tomcat日誌
tomcat實時日誌查看
[root@tomcat01 tomcat8]# tailf /usr/local/include/tomcat8/logs/catalina.out
22-Apr-2017 23:08:29.659 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/include/tomcat8/webapps/host-manager has finished in 44 ms
22-Apr-2017 23:08:29.663 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/include/tomcat8/webapps/ROOT
22-Apr-2017 23:08:29.690 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/include/tomcat8/webapps/ROOT has finished in 27 ms
22-Apr-2017 23:08:29.691 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/include/tomcat8/webapps/examples
22-Apr-2017 23:08:29.954 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/include/tomcat8/webapps/examples has finished in 259 ms
22-Apr-2017 23:08:29.955 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/include/tomcat8/webapps/manager
22-Apr-2017 23:08:29.982 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/include/tomcat8/webapps/manager has finished in 27 ms
22-Apr-2017 23:08:29.990 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-80"]
22-Apr-2017 23:08:30.019 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
22-Apr-2017 23:08:30.036 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 26300 ms
3.Tomcat配置文件
3.1 Tomcat配置文件介紹
[root@tomcat01 tomcat8]# ll /usr/local/include/tomcat8/conf/
total 228
drwxr-x--- 3 root root 4096 Apr 22 15:00 Catalina
-rwxr-xr-x 1 root root 12895 Apr 13 20:58 catalina.policy
-rwxr-xr-x 1 root root 7376 Apr 13 20:58 catalina.properties
-rwxr-xr-x 1 root root 1338 Apr 22 21:41 context.xml
-rwxr-xr-x 1 root root 1149 Apr 13 20:58 jaspic-providers.xml
-rwxr-xr-x 1 root root 2358 Apr 13 20:58 jaspic-providers.xsd
-rwxr-xr-x 1 root root 3622 Apr 13 20:58 logging.properties
-rwxr-xr-x 1 root root 7509 Apr 22 15:05 server.xml #→主配置文件
-rwxr-xr-x 1 root root 2298 Apr 22 22:10 tomcat-users.xml #→Tomcat管理用戶配置文件
-rwxr-xr-x 1 root root 2633 Apr 13 20:58 tomcat-users.xsd
-rwxr-xr-x 1 root root 168133 Apr 13 20:58 web.xml
3.2 Tomcat配置管理界面(註意:測試功能,生產環境不要用。)
Tomcat管理功能用於對Tomcat自身以及部署在Tomcat上的應用進行管理的web應用。在默認情況下是處於禁用狀態的。如果需要開啟這個功能,就需要配置管理用戶,即配置上面提到的tomcat-users.xml。
配置tomcat-users.xml文件
[root@tomcat01 tomcat8]# vim /usr/local/include/tomcat8/conf/tomcat-users.xml
…………
<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
<role rolename="manager-status"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<user username="tomcatadmin" password="Foxconn99" roles="admin-gui,manager-gui,manager-status,manager-script,manager-jmx" />
</tomcat-users> #在此行前加入上面六行
配置完後,重新啟動tomcat服務生效
[root@tomcat ~]# /usr/local/include/tomcat8/bin/shutdown.sh
[root@tomcat ~]# /usr/local/include/tomcat8/bin/startup.sh
配置context.xml文件
[root@tomcat02 conf]# find / -name context.xml
/usr/local/include/tomcat8/webapps/host-manager/META-INF/context.xml #修改訪問IP列表
/usr/local/include/tomcat8/webapps/manager/META-INF/context.xml #修改訪問IP列表
/usr/local/include/tomcat8/conf/context.xml #此處不用修改
修改/usr/local/include/tomcat8/webapps/host-manager/META-INF/context.xml,添加“192.\d+.\d+.\d+”代表可遠程訪問該服務器的IP地址段,192...*(此處註意正則表達式)
[root@tomcat02 conf]# vim /usr/local/include/tomcat8/webapps/host-manager/META-INF/context.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context antiResourceLocking="false" privileged="true" >
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1|192\.\d+\.\d+\.\d+" />
</Context>
修改/usr/local/include/tomcat8/webapps/host-manager/META-INF/context.xml,添加“192.\d+.\d+.\d+”代表可遠程訪問該服務器的IP地址段,192...*(此處註意正則表達式)
[root@tomcat02 conf]# vim /usr/local/include/tomcat8/webapps/manager/META-INF/context.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context antiResourceLocking="false" privileged="true" >
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1|192\.\d+\.\d+\.\d+" />
</Context>
重新啟動tomcat服務
[root@tomcat02 conf]# /usr/local/include/tomcat8/bin/catalina.sh stop
Using CATALINA_BASE: /usr/local/include/tomcat8
Using CATALINA_HOME: /usr/local/include/tomcat8
Using CATALINA_TMPDIR: /usr/local/include/tomcat8/temp
Using JRE_HOME: /usr/local/include/jdk/
Using CLASSPATH: /usr/local/include/tomcat8/bin/bootstrap.jar:/usr/local/include/tomcat8/bin/tomcat-juli.jar
[root@tomcat02 conf]# /usr/local/include/tomcat8/bin/catalina.sh start
Using CATALINA_BASE: /usr/local/include/tomcat8
Using CATALINA_HOME: /usr/local/include/tomcat8
Using CATALINA_TMPDIR: /usr/local/include/tomcat8/temp
Using JRE_HOME: /usr/local/include/jdk/
Using CLASSPATH: /usr/local/include/tomcat8/bin/bootstrap.jar:/usr/local/include/tomcat8/bin/tomcat-juli.jar
Tomcat started.
此時可以就可以正常開啟tomcat的Manager App、Host Manager、Server Status等頁面
4.在Tomcat上部署Jenkins系統
4.1將下載好的Jenkins的war包放在/data/www/jenkins/文件夾下面
[root@tomcat02 jenkins]# pwd
/data/www/jenkins
[root@tomcat02 jenkins]# ll
total 67064
-rwxrwxrwx 1 root root 68669812 Apr 11 21:32 jenkins.war
4.2在/usr/local/include/tomcat8/conf/Catalina/localhost/目錄下面新建一個名為jenkins.xml的文件。
文件內容如下:
<Context path="jenkins" docBase="/data/www/jenkins/jenkins.war" />
註意:實際上jenkins的war包直接復制到/usr/local/include/tomcat8/webapps/下,就會自動解壓,在webapps目錄下面自動生成jenkins目錄。而且,在發布war包的應用程式時,最好提前停止Tomcat服務。
JDK+Tomcat+Jenkins部署