How to Install Jenkins on Ubuntu Server 18.04
Disclosure. This post contains links to products (marked with *) that may earn us a small commission at no extra cost to you, should you click on them and make a purchase.
This tutorial will show you how to install and configure Jenkins on Ubuntu Server 18.04. We will also install the Blue Ocean plugins so that you have a better UI for creating Pipelines.
What is Jenkins?
Jenkins is an automation server which allows you to setup continuous integration / continuous delivery (CI/CD) for your software development projects. Jenkins is used by DevOps teams to increase reliability of code, and to speed up software evolution.
You’ll need a physical or virtual machine (VM) with Ubuntu Server 18.04 installed. You can test the following instructions on your Windows machine by installing VMware Workstation* and creating a VM. If you’re a Mac user, you can use VMware Fusion*, which is what I used to test the steps in this tutorial.
Okay, let’s get started.
Step 1: Install Jenkins
Log into your Ubuntu Server and at the console or using SSH run the following commands:
sudo apt update sudo apt install -y default-jdk git wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add - sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9B7D32F2D50582E6 sudo apt-get update sudo apt-get install -y jenkins
Step 2: Unlock Jenkins
The first time you navigate to the UI, you will be asked to Unlock Jenkins by providing the default password.
Enter the IP or hostname of the Ubuntu server in a browser using port
The image above shows the path containing the default password. Run the following command at the terminal to see it:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Enter the password and click Continue.
Once you’ve entered the password, you’ll be asked to Customize Jenkins. Click the Install suggested plugins button.
Enter login credentials for the first user then click Save and Continue.
Enter the Jenkins URL. I’ve left it as the IP address but you’ll want to specify a domain name that will be pointed at the IP address of the server.
Click Start using Jenkins.
Step 3: Install the Blue Ocean Plugin
The Blue Ocean plugin is an improved user interface that makes it easier to setup pipelines. Let’s install it by clicking on Manage Jenkins.
Click Manage Plugins.
Click the Available tab then type Blue Ocean in the filter.
Select all the Blue Ocean plugins.
Scroll to the bottom and click Install without restart.
Tick the Restart Jenkins when install is complete checkbox and wait for the plugins to install. This might take awhile, and you may need to refresh the page, if it freezes on the Loading plugin extensions step.
Login to Jenkins with the user you created.
Click Open Blue Ocean.
You are now ready to create your first Pipeline.
That’s it. You now know how to install Jenkins on Ubuntu Server 18.04, how to configure the initial user, and how to install Blue Ocean plugins. Blue Ocean is an improved user interface that makes it easier to create pipelines.