4 min to read
How To Setup Jenkins On Ubuntu 20.04LTS
Automate Application Build and Deployments Using Jennkins CI/CD Pipelines
Setup Jenkins On Ubuntu 20.04LTS
Jenkins is an open-source continues integration and continues deployment tool. Which can use to automate application building, testing and deploying. Jenkins is the most popular automation server. Jenkins built using java, which can integrate with numerous plugins.
OS Requirement: Make sure to use Ubuntu LTS versions
|Minimum Hardware Requirement||Recommended Hardware Requirement|
|1GB+ Hard Disk Space||50GB+ Hard Disk Space|
|256 MB RAM||1GB + RAM|
- Java - JRE8/11 (32Bit or 64Bit Supported)
Note: Older versions and Java 9, 10,12 are not supported
|OpenJDK 8 , OpenJRE 8||JRE 8|
|OpenJDK 11 , OpenJRE 11||JRE 11|
STEP 01: Update OS
sudo apt update -y
STEP 02: Install Java
Jenkins is built with Java, So we need to install the appropriate Java version. This time I’m going to use OpenJDK version 11. Now head-over to your ubuntu terminal and do the following steps.
Run this command and pick one OpenJDK version 8 or 11 from the list
sudo apt search openjdk
sudo apt-get install openjdk-11-jdk -y
dimuthu@build-svr:~$ java -version openjdk version "11.0.10" 2021-01-19 OpenJDK Runtime Environment (build 11.0.10+9-Ubuntu-0ubuntu1.20.04) OpenJDK 64-Bit Server VM (build 11.0.10+9-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
STEP 03: Add GPG Key and Repository
Install GPG Trusted Key
sudo wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
Add Jenkins Repository
This step is to append the Jenkins repository in the Debian source.list
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
Once again, update OS repositories.
sudo apt-get update -y
sudo apt-get install jenkins -y
STEP 04: Enable & Start Jenkins
Start & enable Jenkins service on system boot.
sudo systemctl enable jenkins sudo systemctl start jenkins
Optionally, Sometimes you need to allow TCP port 8080 though out the firewall. If you are using Ubuntu, execute the following command.
sudo ufw allow 8080
STEP 05: Access Jenkins
Now, You can access your Jenkins server through the web browser.
For the 1st time, Jenkins will prompt to enter an unlock password. You need to execute the following command on your terminal and copy the output password and paste it into the Administrator password text box.
Troubleshooting: If the "initialAdminPassword" not available, You may have to remove jenkins and try again.
REF: Admin Password Not Available
For the first time, Jenkins will prompt us to unlock, and it will tell us to copy the password from this location. Copy this 32charactor alphanumeric password and paste it into the text box in the wizard.
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
STEP 07: Install Plugins
In this section, You will need to install Jenkins plugins according to how going to use them. You can choose either option.
In this case, I’m choosing the “select plugins to install option.”
Once you choose the required plugins, click next. This plugin installation may take considerable time. Please wait until completed.
STEP 08: Create First Admin User
Next, You have to provide your “name”, username”, “password”, and “email” for the Jenkins admin user.
Next, You need to provide your FQDN or IP address. By default, the IP address will automatically load into the “instance URL” section.
Now, Jenkins installation has been completed successfully. This is the 1st session of the Jenkins tutorial series. If you love to learn more about Jenkins, refer to my other articles available on this website.
If you are facing issues with the installation, please comment below. I will regularly reply here.
And also don’t forget to subscribe my YouTube channel for upcoming tutorials.