Ubuntu 安装jenkins

来源:互联网 发布:linux rpm 安装目录 编辑:程序博客网 时间:2024/05/21 06:37

首先在jenkins官网上下载jenkins.war包。下载后,将war包上传到jerry/webapps目录下,并在此目录中新建文件jenkins.xml,文件完整内容如下:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd"><!-- ==================================================================Configure and deploy the test web application in $(jetty.home)/webapps/testNote. If this file did not exist or used a context path other that /testthen the default configuration of jetty.xml would discover the testwebapplication with a WebAppDeployer.  By specifying a context in thisdirectory, additional configuration may be specified and hot deploymentsdetected.===================================================================== --><Configure id="jenkinsWebapp" class="org.eclipse.jetty.webapp.WebAppContext">  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->  <!-- Required minimal context configuration :                        -->  <!--  + contextPath                                                  -->  <!--  + war OR resourceBase                                          -->  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->  <Set name="contextPath">/jenkins</Set>  <Set name="war"><Property name="jetty.home" default="."/>/webapps/jenkins.war</Set>  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->  <!-- Optional context configuration                                  -->  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->  <Set name="extractWAR">true</Set>  <Set name="copyWebDir">false</Set>  <Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>  <!--Set name="overrideDescriptor"><Property name="jetty.webapps" default="."/>/test.d/override-web.xml</Set-->  <!-- Enable WebSocket container -->  <Call name="setAttribute">    <Arg>org.eclipse.jetty.websocket.jsr356</Arg>    <Arg type="Boolean">true</Arg>  </Call>  <Set name="gzipHandler">    <New class="org.eclipse.jetty.server.handler.gzip.GzipHandler">      <Set name="minGzipSize">2048</Set>          </New>  </Set>  <!-- Set Caching Classloader that improves performance on resource searching webapps -->  <!--  <Set name="classLoader">    <New class="org.eclipse.jetty.webapp.CachingWebAppClassLoader">      <Arg><Ref refid="testWebapp"/></Arg>    </New>  </Set>  -->  <!-- Enable symlinks   <Call name="addAliasCheck">    <Arg><New class="org.eclipse.jetty.server.handler.AllowSymLinkAliasChecker"/></Arg>  </Call>  -->  <!-- virtual hosts  <Set name="virtualHosts">    <Array type="String">      <Item>www.MyVirtualDomain.com</Item>      <Item>m.MyVirtualDomain.com</Item>      <Item>*.OtherVirtualDomain.com</Item>      <Item>@ConnectorName</Item>      <Item>localhost</Item>      <Item>127.0.0.1</Item>    </Array>  </Set>  -->  <!-- disable cookies  <Get name="sessionHandler">     <Get name="sessionManager">        <Set name="usingCookies" type="boolean">false</Set>     </Get>  </Get>  -->  <Get name="securityHandler">    <Set name="loginService">      <New class="org.eclipse.jetty.security.HashLoginService">        <Set name="name">jenkins Realm</Set>        <Set name="config"><SystemProperty name="jetty.base" default="."/>/etc/realm.properties</Set>            <!-- To enable reload of realm when properties change, uncomment the following lines -->            <!-- changing refreshInterval (in seconds) as desired                                -->            <!--            <Set name="refreshInterval">5</Set>            <Call name="start"></Call>            -->      </New>    </Set>    <Set name="authenticator">      <New class="org.eclipse.jetty.security.authentication.FormAuthenticator">        <Set name="alwaysSaveUri">true</Set>      </New>    </Set>    <Set name="checkWelcomeFiles">true</Set>  </Get>  <!-- Non standard error page mapping -->  <!--  <Get name="errorHandler">    <Call name="addErrorPage">      <Arg type="int">500</Arg>      <Arg type="int">599</Arg>      <Arg type="String">/dump/errorCodeRangeMapping</Arg>    </Call>  </Get>  -->  <!-- Add context specific logger  <Call name="insertHandler">    <Arg>      <New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler">        <Set name="requestLog">          <New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">            <Set name="filename"><Property name="jetty.logs" default="./logs"/>/test-yyyy_mm_dd.request.log</Set>            <Set name="filenameDateFormat">yyyy_MM_dd</Set>            <Set name="append">true</Set>            <Set name="LogTimeZone">GMT</Set>          </New>        </Set>      </New>    </Arg>  </Call>  --></Configure>

注意修改其中jenkins war包的路径。然后cd 到/etc/jetty目录,执行java -jar start.jar 命令启动jetty。启动成功后,访问jenkins:

这里写图片描述

注意,这里可能需要修改jenkins工作的主目录,后续因为编译任务增多,默认的目录可能不适合。按照如下步骤修改:

使用vi /etc/profile 命令来编辑该文件,在该文件末尾添加:
export JENKINS_HOME=/apphome/jenkins
保存后退出,并在shell中执行source /etc/profile。
重启jetty。
这里写图片描述

0 0
原创粉丝点击