这两天打算将项目的编译打包工作交给内网服务器,尝试了使用apt-get install jenkins的方式安装,虽然能够顺利安装成功,但因为其使用的jenkins用户权限调整后总是出问题,于是打算用jenkins.war包来使用。
其实官网有详细的流程,这里转载过来,以备不时之需。 Java Service Wrapper
The The Java Service wrapper is a wrapper that works both on Unix and Windows. It requires some set up but when it is setup it can be used as any other unix service (like start/stop).
This example will install a Jenkins instance in /home/jenkins on a debian machine. The Jenkins configuration is stored in /home/jenkins/data. Jenkins will be running on port 8070 and as the jenkins user.
Select and download a JSW package from the JSW wrapper download page.
Unpack the package into the /home/jenkins path.
Create /home/jenkins/tmp as the temporary directory for JSW.
Download the jenkins.war file into /home/jenkins/lib.
If you have plugins that you would like to use, download them into /home/jenkins/data/plugins.
Copy the /home/jenkins/src/conf/wrapper.conf.in to /home/jenkins/conf/wrapper.conf and change the below configuration properties in the file.
# Set directly the time zone of the JVM, by setting this we do not rely on the time zone of the server.
# Uncomment the following line if needed.
# wrapper.java.additional.4=-Duser.timezone=America/Los_Angeles
wrapper.console.title=Jenkins Continuous build server
Verify the wrapper configuration by starting Jenkins through /home/jenkins/bin/testwrapper console. Jenkins should be accessible through http://localhost:8070, if not check the console output for errors.
Copy the /home/jenkins/src/bin/sh.script.in to /etc/init.d/jenkins and change the below configuration properties in the file.
Verify installation by starting the daemon through /etc/init.d/jenkins start. Make sure that /etc/init.d/jenkins has the correct permissions; normally 755 is ok for this.