How to Install Jenkins on Ubuntu 18.04

r00t August 5, 2018

Install Jenkins on Ubuntu 18.04

In this tutorial we are going to learn how to install Jenkins on Ubuntu 18.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 18.04 Bionic Beaver minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install Jenkins on Ubuntu 18.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.

Since Jenkins requires Java, you must first install it:

sudo add-apt-repository ppa:webupd8team/java

Run the commands below to download Oracle Java 8 installer

sudo apt install oracle-java8-installer
sudo apt install oracle-java8-set-default

Now verify that it installed:

java -version

Step 3. Installing Jenkins on Ubuntu 18.04 Bionic Beaver.

First, add the signing key for the Jenkins repository:

wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -

To install stable releases of Jenkins, run the following command to add the stable repository.

sudo apt-add-repository "deb https://pkg.jenkins.io/debian-stable binary/"

Now install and configure Jenkins on our Ubuntu server:

sudo apt 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:

http://your_server_IP_or_domain_name:8080

When you that, you’ll get a prompt to enter the initial admin password, run the commands below to view it on the system:

cat /var/lib/jenkins/secrets/initialAdminPassword

Congratulation’s! You have successfully install and configured Jenkins on your Ubuntu 18.04 LTS server. Thanks for using this tutorial for installing Jenkins on Ubuntu 18.04 LTS (Bionic Beaver) system.

The Tags:

Leave a Comment

Comments are closed.