Install and configure the jenkins on ubuntu 22.04; Through this tutorial, we will learn how to install and configure jenkins on ubuntu 22.04.
How to Install and configure the Jenkins on Ubuntu 22.04
Follow the following steps to install and configure jenkins on ubuntu 22.04: is as follows:
- Step 1 – Add Jenkins GPG key
- Step 2 – Add Jenkins Stable Debian Package
- Step 3 – Update Dependencies
- Step 4 – Install Jenkins on Ubuntu
- Step 5 – Opening the Firewall
- Step 6 – Setting Up Jenkins
Step 1 – Add Jenkins GPG key
Open your command prompt and execute the following command on the command prompt to add Jenkins GPG key:
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
Step 2 – Add Jenkins Stable Debian Package
Execute the following command on the command prompt to add Jenkins stable Debian package repository:
echo "deb https://pkg.jenkins.io/debian-stable binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list
Step 3 – Update Dependencies
After both commands have been executed, run
apt update so that
apt will use the new repository:
sudo apt update
Step 4 – Install Jenkins on Ubuntu
Execute the following command on command prompt to install Jenkins and its dependencies:
sudo apt install jenkins
Then execute the following command on command prompt to confirm its status:
systemctl status jenkins
If its not running, start Jenkins using the executing the following command on command prompt:
sudo systemctl start jenkins
Step 5 – Opening the Firewall
By default, Jenkins runs on port
8080. Open that port using
sudo ufw allow 8080
Note: If the firewall is inactive, the following commands will allow OpenSSH and enable the firewall:
sudo ufw allow OpenSSH sudo ufw enable
ufw’s status to confirm the new rules:
sudo ufw status
You’ll notice that traffic is allowed to port
8080 from anywhere:
OutputStatus: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere 8080 ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) 8080 (v6) ALLOW Anywhere (v6)
With Jenkins installed and a firewall configured, you have completed the installation stage and can continue with configuring Jenkins.
Step 6 – Setting Up Jenkins
Use default port,
8080 with your server domain name or IP to set up your installation; address:
Now, we should receive the Unlock Jenkins screen, which displays the location of the initial password:
In the terminal window, use the
cat command to display the password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the 32-character alphanumeric password from the terminal and paste it into the Administrator password field, then click Continue.
The next screen presents the option of installing suggested plugins or selecting specific plugins:
We’ll click the Install suggested plugins option, which will immediately begin the installation process.
When the installation is complete, you’ll be prompted to set up the first administrative user. It’s possible to skip this step and continue as
admin using the initial password from above, but we’ll take a moment to create the user.
Note: The default Jenkins server is NOT encrypted, so the data submitted with this form is not protected. Refer to How to Configure Jenkins with SSL Using an Nginx Reverse Proxy on Ubuntu 22.04 to protect user credentials and information about builds that are transmitted via the web interface.
Enter the name and password for your user:
You’ll receive an Instance Configuration page that will ask you to confirm the preferred URL for your Jenkins instance. Confirm either the domain name for your server or your server’s IP address:
After confirming the appropriate information, click Save and Finish. You’ll receive a confirmation page confirming that “Jenkins is Ready!”:
Click Start using Jenkins to visit the main Jenkins dashboard:
At this point, you have completed a successful installation of Jenkins.
In this tutorial, we have learned how to install and use Jenkins in ubuntu 22.04.