Jenkins is an open source, free software automation server written in Java. Jenkins provides a wide range of plugins for building, deploying, testing and automating. For continuous deployments, Jenkins helps by speeding up processes such as building software or jobs ran by cron, monitoring, and execution of repeated jobs.
Jenkins automates the non-human part of the software development process with continuous integration and facilitating technical aspects of continuous delivery. Jenkins can be installed from Ubuntu packages using apt-get or you can download and run the application from Web Application Archive (WAR) files.
Jenkins supports version control tools, including CVS, Subversion, Git, Mercurial, RTC, etc. You can read more about this in the Jenkins Wiki. We’ll move forward with a step by step installation procedure and configuring Jenkins on Ubuntu 14.04 LTS.
Configure Ubuntu 14.04 LTS and login as root or issue a “
sudo su -” command to gain superuser privileges, so that you can perform basic installations and update your server with the latest packages. When the server is setup you are ready to move forward with next steps.
Before moving on to installing the packages on server, your system package manager needs to be updated. Run the following command to ensure your system package manager is up-to-date:
root@ubuntu:~# apt-get update
Debian-based distributions like Ubuntu will install java with apt-get package manager. This is the easy way to install java with default packages for jre/jdk; execute the following commands:
root@ubuntu:~# apt-get install default-jre
To continue, type ‘Y’.
It will install Java Runtime Environment(JRE). If you need Java Development Kit (JDK), for compiling java applications run the following command:
root@ubuntu:~#sudo apt-get install default-jdk
Type ‘Y’ to continue.
By executing those commands, java will be installed. When installing the latest version of Jenkins, you need to have Java 7 or above, and Java 8 is recommended. If you use the default commands shown above, the latest versions of Java will be installed, and you can skip the steps below and move onto the Jenkins installation.
Some developers prefer using the Oracle JDK instead of OpenJDK. To install the Oracle JDK 7 or 8 execute this series of commands as root with apt-get:
apt-get install python-software-properties
Depending upon your requirements, use the following commands to install:
Oracle JDK 7:
apt-get install oracle-java7-installer
Oracle JDK 8:
apt-get install oracle-java8-installer
While executing the above commands, it will show the required packages to be installed with Java ‘openjdk’. To continue with those packages, type `Y’ or ‘N’ to exit the installer.
This take few minutes to finish the installation.
Once your installation steps are completed, check the version of Java on the server and proceed to Jenkins installation.
root@ubuntu:~# java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
Now you are ready to install Jenkins. Install the latest version of Jenkins so that you can take advantage of the latest fixes. Before doing that you need to add the key and source list for jenkins. Run the following commands:
root@ubuntu:~# wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | apt-key add -
When the key is added, you will get the ‘OK’ response. Next, add the source list:
root@ubuntu:~# echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list
When the keys and sources are added, update the system using apt-get to use a new repository before installing Jenkins.
root@ubuntu:~# apt-get update
Once the update is completed, you are ready for installation of Jenkins. Execute the following command on terminal; it will prompt for ‘Yes’ or ‘No’. Type ‘Y’ and your installation process will be started:
root@ubuntu:~# apt-get install jenkins
It will continue the installation and the daemon will start.
Now, the installation process is completed. To check the status of Jenkins service, run:
root@ubuntu:~# service jenkins status
It will display the status and running process ID(PID).
Jenkins Continuous Integration Server is running with the pid 16845
Voila! Your Jenkins is online and running.
By default, Jenkins runs on port 8080. If port 8080 is busy, you can switch ports by updating the default directory which is located at /etc/default/jenkins and update HTTP_PORT to 8081(HTTP_PORT=8081).
Configure Jenkins On The Web
After a successful installation of Jenkins, you need to configure its GUI on one of your favourite web browsers. You can access the server by using your ip address and port, like this:
http://localhost:8080 or http://your-ip-address:8080
You are able to see the display screen, which will ask for a password. Your password can be found in /var/lib/jenkins/secrets/initialAdminPassword. Enter the password in the ‘Administrator Password’ field and click continue.
You should now see a ‘Customize Jenkins’ page where you will select how to install your plugins.
After installing your plugins, it will be time to create an admin account to log in to Jenkins.
Complete the required fields, and click on save and finish.
You now have successfully setup Jenkins and your brand new Jenkins server is ready for use!
Installing and configuring Jenkins can be daunting, but following the steps outlined in this post will make it easy and straightforward. This basic installation would be suitable for local use or on a private network. To run Jenkins on the public Internet, it would be wise to run it behind a reverse proxy that terminated SSL, either using a load balancer such as AWS ELB or using NGINX or Apache with Lets Encrypt for certificate management.
- Integrating BDD Cucumber Test Suites in Jenkins in 3 Steps
Behaviour Driven Development improves communication between Developers, Testers and the product owners and over a…
- Securing Jenkins on Mac OS X with Let's Encrypt
When using Jenkins to build iOS applications on Mac OS X, it’s very important to…