In this tutorial we’ll learn how to install Jenkins on Ubuntu 16.04. We will also install and configure its prerequisites. Jenkins is the most widely used open source constant integration and automation machine. It provides a huge variety of neighborhood plug-ins to encourage construction, deploying and automating any project, large or little.
I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 16.04 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install Jenkins on Ubuntu 16.04
Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:
apt-get update -y apt-get upgrade -y
Step 2. Installing Java.
Jenkins requires Java, Install OpenJDK8 on the server:
sudo apt-get install openjdk-8-jre-headless -y
Now verify that it installed:
Step 3. Installing Jenkins.
First, add Jenkins repository as the Jenkins is not available on Ubuntu 16.04 base repositories.
Add the Jenkins key to the system:
wget https://pkg.jenkins.io/debian-stable/jenkins.io.key sudo apt-key add jenkins.io.key
Add the Jenkins repository information on your system:
echo "deb https://pkg.jenkins.io/debian-stable binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list
Update repository and install Jenkins:
sudo apt-get update sudo apt-get -y install jenkins
Run the following systemctl commands to start and enable the jenkins service:
systemctl start jenkins systemctl enable jenkins
After the installation, we need to allow port 80 & 8080 on the firewalld of the system. Run:
firewall-cmd --permanent --add-port=8080/tcp firewall-cmd --reload
Step 4. Access the Jenkins Web portal.
Now, access the Jenkins using the below address from your web browser:
Congratulation’s! You have successfully install and configured Jenkins on your Ubuntu 16.04 server. Thanks for using this tutorial for installing Jenkins on Ubuntu 16.04 LTS (Xenial Xerus) system.