Professional Documents
Culture Documents
Jenkins setup
Continuous integration setup
Here is a short table of content:
In order to install Jenkins onto a Ubuntu Linux, you need to follow this manual. Here we will explain how to install Jenkins and how to
move it to another access location, available from the browser.
Installing Jenkins
Execute following commands in terminal:
wget-q-O-https://jenkins-ci.org/debian/jenkins-ci.org.key|sudoapt-keyaddsudosh-c'echodebhttp://pkg.jenkins-ci.org/debianbinary/>/etc/apt/sources.list.d/jenkins.li
st'
sudoapt-getupdate
sudoapt-getinstalljenkins
Once this is completed, you have Jenkins up and running and you should be able to browse to your newly created Jenkins site at
http://localhost:8080/
To start Jenkins, you can run:
sudo/etc/init.d/jenkinsstart
sudo/etc/init.d/jenkinsstop
In order to boot the Jenkins at every Ubuntu boot, you need to add the following line to the end of /etc/rc.local file, just before exit 0:
/etc/init.d/jenkinsstart
In the future you can simply run the following command if you would like to update Jenkins:
apt-getupdate
apt-getinstallJenkins
09/15/2016
1/4
To get the nice URL you saw in the previous section youll first have to edit the file /etc/default/jenkins file by adding
--prefix=/jenkins to the JENKINS_ARGS section of the file. Once thats been done you should restart Jenkins by running the
following command:
sudo/etc/init.d/jenkinsforce-reload
sudoapt-getinstallapache2
Thats fairly straightforward to do Once you have Apache installed you should also install the following package:
sudoapt-getinstalllibapache2-mod-proxy-html
This will install the proxy libraries necessary to enable us to route all calls coming into our nice URL to the Jenkins server still running
on port 8080. Once you have this package installed you should run the following two commands:
sudoa2enmodproxy
And youll also need to enable the http proxy by running this command:
sudoa2enmodproxy_http
Once these are enabled I would suggest that you also disable the root domain by running the following command:
sudoa2dissite000-default
The next step would be to change the Apache configuration to point to your new Jenkins Build Server. To do this you can run:
sudonano/etc/apache2/apache2.conf
When the file opens you should add the following to the bottom of the file:
ServerNamelocalhost:8080
09/15/2016
2/4
Now youll need to create a new Virtual Host for Apache to serve. You do this by making a jenkins file by running the following
command:
sudotouch/etc/apache2/sites-available/jenkins.conf
sudonano/etc/apache2/sites-available/jenkins.conf
When the file is open you should add the following to it:
<VirtualHost*:80>
ProxyPass/jenkinshttp://localhost:8080/jenkinsnocanon
ProxyPassReverse/jenkinshttp://localhost:8080/jenkins
ProxyRequestsOff
AllowEncodedSlashesNoDecode
#Localreverseproxyauthorizationoverride
#Mostunixdistributiondenyproxybydefault
#(ie/etc/apache2/mods-enabled/proxy.confinUbuntu)
<Proxyhttp://localhost:8080/jenkins>
Orderdeny,allow
Allowfromall
</Proxy>
</VirtualHost>
The final step in this configuration is to enable Jenkins and to restart Apache. You can enable Jenkins by running the following
command:
sudoa2ensitejenkins.conf
Now that you have Apache installed and running and youve enabled it for proxy capabilities you should restart it by running the
command as follows:
sudo/etc/init.d/apache2restart
You can also restart Apache by running the stop and start commands separately by running the following two lines on Terminal:
sudo/etc/init.d/apache2stop
sudo/etc/init.d/apache2start
09/15/2016
3/4
Follow previous steps that will explain how to install Jenkins and set it up with apache2 to work (if you want a friendly path inside
the server)
Stop Jenkins on old and new server (you have a command explained in previous section).
Copy content of JENKINS_HOME dirrectory (if you followed above rules, that directory will be /var/lib/jenkins/) to new server
Start Jenkins on new server (you have a command explained in previous section).
Check all installed plugins on old server, if they are not available on new one, you will need to install them there.
Useful links
Links that were used during the creation of this manual:
http://yakiloo.com/setup-apache-and-jenkins/
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu
https://wiki.jenkins-ci.org/display/JENKINS/Running+Jenkins+behind+Apache
https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins
Jenkins to Redmine issue notification plugin: https://github.com/akiko-pusu/redmine-build-notifier-plugin
09/15/2016
4/4