前提:Tomcat、jdk已安裝並配置成功,具體安裝和配置可參考個人其餘隨筆,在此再也不詳述web
一、官網下載Jenkins最新war包,jenkins.warapache
二、進入Tomcat安裝目錄,建立Jenkins訪問站點文件夾,webapps-jenkinstomcat
三、上傳jenkins.war至webapps-jenkins文件夾app
四、切換至conf目錄,修改server.xml,配置Jenkins訪問端口號webapp
<?xml version="1.0" encoding="UTF-8"?> <Server port="8008" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.startup.VersionLoggerListener" /> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <GlobalNamingResources> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <Service name="Catalina"> <Connector port="8088" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8010" protocol="AJP/1.3" redirectPort="8443" /> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> </Engine> </Service> <Service name="CatalinaJenkins"> <Connector port="8089" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8011" protocol="AJP/1.3" redirectPort="8443" /> <Engine name="CatalinaJenkins" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps-jenkins" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> </Engine> </Service> </Server>
五、重啓Tomcat,Jenkins war包會自動被解壓spa
六、訪問Jenkinscode