Jenkins

Jenkins Tutorial: How to install Jenkins on Ubuntu?

2 Mins read

Before moving on to the installation of Jenkins, let’s talk about it. Jenkins is a very popular Continuous integration tool. Jenkins is used in most CI / CD processes. In addition to being open-source, process automation is very easy, thanks to the many add-ons it offers. You can follow this link for more information.

Prerequisites

  • Ubuntu Server 18.04 (This guide will use this OS)
  • A user account with SUDO privileges.
  • Java 8 (Jenkins supports this version)

Steps for Jenkins Installation

  1. Install Java 8
  2. Configure Jenkins Repository and Source List
  3. Install Jenkins on the Server
  4. Configure firewall
  5. Configure Jenkins on the Web UI
  6. Finish the installation

1) Install Java 8 on Ubuntu

First of all, it would be better to check if Java is installed on the server. If it is already installed, you can skip this step.

java -version
check if java installed

It is currently not installed on the server. So, let’s install the Java JDK 8.

sudo apt-get install openjdk-8-jdk
install java jdk 8 on ubuntu

Now, we are going to check if the Java is installed.

java -version
check java version

Conguratulations! Java JDK 8 is installed successfully!

2) Configure Jenkins Repository and Source List

Next, we are going to configure Jenkins Repository and update the Source List.

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

sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
add jenkins repo to source list

Finally, update the source list with the following command:

sudo apt-get update
apt-get update

Jenkins Repository is configured and Source List is updated successfully.

3) Install Jenkins on the Server

Now, it is time to start installation of Jenkins.

sudo apt-get install jenkins -y
jenkins install

Check the Jenkins service is running

sudo systemctl status jenkins
check if jenkins service is started

Jenkins is now installed and running successfully! If it is not running automatically, you can run the following command to start Jenkins service manually:

sudo systemctl start jenkins
start jenkins service

4) Configure Firewall for Jenkins

Jenkins is using the 8080 port for communication on the Web side. We need to make sure that, the 8080 port is allowed on the firewall.

sudo ufw allow 8080
configure firewall for jenkins

5) Configure Jenkins on the Web UI

Jenkins is now installed and configured. Next, finish the configurations on the Web UI side. Jenkins Web UI can be accessed from http://<IP or Hostname>:8080.

unlock jenkins

First of all, when you access the page, it will ask for a password which is stored in the file system on the host that Jenkins is installed. The file is stored in the following path: /var/lib/jenkins/secrets/initialAdminPassword

sudo cat /var/lib/jenkins/secrets/initialAdminPassword
get password for jenkins

After typing the password in the field on the page, click the Continue button.

After that, the following page will come out. On this page, you can select which plugins will be installed by the first installation.

customize jenkins plugins

If you choose “Select plugins to install” option, the following page will appear.

jenkins plugin selections

In this guide, we are going to continue with the default popular plugins. So, select “Install suggested plugins” and click the Install button.

Jenkins will download and install the plugins you have selected or the suggested plugins.

jenkins plugin installation progress

After Jenkins install the plugins, it will redirect you to create a new user. On this page, you can create a user or skip this step and continue as an admin user. It is better to create an admin user by filling the required fields. Then click on the Save and Continue button.

jenkins first user creation

Next, the Instance Configuration page will appear. On this page, you can configure the Jenkins accessible address. We will leave it as default.

jenkins instance configuration

Congratulations! You have installed and configured Jenkins successfully!

jenkins
jenkins is ready

Recep Duman
26 posts

About author
I am a fan of programming, innovation, and web development. I’m also interested in technology and entrepreneurship.
Articles
Related posts
Jenkins

Jenkins Tutorial: How to add Linux Node (Slave) to Jenkins?

3 Mins read
We have performed the installation of Jenkins on Ubuntu in the previous guide. Now, it is time to add Jenkins Linux Node…
Jenkins

What is Jenkins?

2 Mins read
Jenkins is the leading open-source Continuous Integration tool. It provides over 1000 plugins to support the creation and testing of almost any…
Subscribe to Newsletter

To get the latest news, subscribe our channel.

Leave a Reply

Your email address will not be published. Required fields are marked *

×
Jenkins

What is Jenkins?