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.
- 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
- Install Java 8
- Configure Jenkins Repository and Source List
- Install Jenkins on the Server
- Configure firewall
- Configure Jenkins on the Web UI
- 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.
It is currently not installed on the server. So, let’s install the Java JDK 8.
sudo apt-get install openjdk-8-jdk
Now, we are going to check if the Java is installed.
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 -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
Finally, update the source list with the following command:
sudo 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
Check the Jenkins service is running
sudo systemctl status jenkins
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
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
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.
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:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
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.
If you choose “Select plugins to install” option, the following page will appear.
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.
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.
Next, the Instance Configuration page will appear. On this page, you can configure the Jenkins accessible address. We will leave it as default.
Congratulations! You have installed and configured Jenkins successfully!