How to Install Jenkins on Ubuntu 20.04
Jenkins is an open-source mechanization worker that can be utilized to effortlessly set up ceaseless reconciliation and persistent conveyance (CI/CD) pipelines.
Consistent combination (CI) is a DevOps practice in which colleagues normally submit their code changes to the adaptation control archive, after which robotized manufactures and tests are run. Persistent conveyance (CD) is a progression of practices where code changes are naturally fabricated, tried, and sent to creation.
Jenkins can be introduced as an independent application, as a servlet in a Java servlet holder, for example, Apache Tomcat or can be run as a Docker compartment.
This article discloses how to introduce Jenkins on Ubuntu 20.04 as an independent help.
Installing Java
Jenkins is a Java application and requires Java 8 or later to be introduced on the framework. We'll introduce OpenJDK 11 , the open-source usage of the Java Platform.
Run the accompanying orders as root or client with sudo benefits or root to introduce OpenJDK 11:
sudo apt update
sudo apt install openjdk-11-jdk
When the establishment is finished, confirm it by checking the Java variant:
java -version
The yield should look something like this:
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)
Installing Jenkins
Introducing Jenkins on Ubuntu is moderately clear. We'll empower the Jenkins APT storehouse, import the vault GPG key, and introduce the Jenkins bundle.
Import the GPG keys of the Jenkins archive utilizing the accompanying wget order:
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
Next, add the Jenkins storehouse to the framework with:
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
When the Jenkins store is empowered, update the adept bundle list and introduce the most recent rendition of Jenkins by composing:
sudo apt update
sudo apt install jenkins
On the off chance that you get a mistake message saying:
Error: W: GPG error: https://pkg.jenkins.io/debian-stable binary/ Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 9B7D32F2D50582E6"
Import the key with:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9B7D32F2D50582E6
Jenkins administration will consequently begin after the establishment cycle is finished. You can check it by printing the administration status:
systemctl status jenkins
You should see something like this:
jenkins.service - LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; generated)
Active: active (exited) since Thu 2020-07-16 20:22:12 UTC; 15min ago
...
Adjusting Firewall
In the event that you are introducing Jenkins on a distant Ubuntu worker that is ensured by a firewall , you'll have to open port 8080. Normally, you would need to permit admittance to the Jenkins worker just from a particular IP address or IP run. For instance, to permit
sudo ufw allow proto tcp from 192.168.121.0/24 to any port 8080
On the off chance that you have to permit access from anyplace run:
sudo ufw allow 8080
Setting Up Jenkins
To set up your new Jenkins establishment, open your program, type your area or IP address followed by port 8080, http://your_ip_or_domain:8080.
A page like the accompanying will be shown, inciting you to enter the Administrator secret word that is made during the establishment:
Use feline to show the secret phrase on the terminal:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
You should see a 32-character long alphanumeric secret key, as demonstrated as follows:
06cbf25d811a424bb236c76fd6e04c47
Duplicate the secret word from the terminal, glue it into the "Head secret key" field and snap "Proceed".
On the following screen, the arrangement wizard will ask you whether you need to introduce recommended modules or you need to choose explicit modules.
Snap on the "Introduce recommended modules" box and the establishment cycle will begin right away.
Once the modules are introduced, you will be provoked to set up the first administrator client. Round out completely required data and snap "Spare and Continue".
The following page will approach you to set the URL for your Jenkins case. The field will be populated with a naturally produced URL.
Affirm the URL by tapping on the Save and Finish button, and the arrangement cycle will be finished.
Snap on the Start utilizing Jenkins catch, and you will be diverted to the Jenkins dashboard signed in as the administrator client you have made in one of the past advances.
Now, you've effectively introduced Jenkins on your worker.
Conclusion
In this instructional exercise, we have told you the best way to introduce and finish the underlying arrangement of Jenkins on Ubuntu frameworks.
You would now be able to visit the authority Jenkins documentation page and begin investigating Jenkins' work process and module model.
In the event that you have any inquiries, kindly leave a remark underneath.