Installing Jenkins on Ubuntu Server
- Jenkins
Jenkins is an excellent platform for managing automated builds and getting started on Ubuntu Server is a snap. This guide covers the setup of Jenkins as well as how to use the default Ubuntu Apache web-server installation as a front-end to make URL’s nicer.
Installing Jenkins
Installing Jenkins itself is pretty straightforward using default package system:
sudo apt-get install jenkins
After the installation completes you can access the Jenkins installation at http://SERVER_IP:8080/
Configuring Apache
With Jenkins now running lets do something to hide the port at the end. Maybe somewhere down the road you’ll want to change the port that Jenkins runs on (as 8080 is a commonly used port), hiding this detail away allows for changes in the future without anyone needing to update their bookmarks.
In this example http://builds.mydomain.com is the target URL where Jenkins should be accessed. First, create a new available site to configure Apache to route requests for this domain to Jenkins.
sudo touch /etc/apache2/sites-available/builds-mydomain
Open this file and add the following configuration.
<VirtualHost *:80>
ServerName builds.mydomain.com
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
ProxyRequests Off
<Proxy http://localhost:8080/*>
Order deny,allow
Allow from all
</Proxy>
</VirtualHost>
Using mod_proxy Apache is able to forward requests back and forth via the specified ServerName entry. After saving the configuration enable the site and then reload the Apache configuration.
sudo a2ensite builds-mydomain
sudo service apache2 reload
There you have it, a simple setup for a powerful continuous integration server!