How to Install and configure the Jenkins on Ubuntu 22.04

How to Install and configure the Jenkins on Ubuntu 22.04

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 ufw:

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

Check 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: http://your_server_ip_or_domain:8080

Now, we should receive the Unlock Jenkins screen, which displays the location of the initial password:

unlock-jenkins
unlock-jenkins

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:

customize_jenkins_screen_two
customize_jenkins_screen_two

We’ll click the Install suggested plugins option, which will immediately begin the installation process.

jenkins_plugin_install_two
jenkins_plugin_install_two

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.

jenkins_create_user
jenkins_create_user

Enter the name and password for your user:

jenkins_user_info
jenkins_user_info

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:

instance_confirmation
instance_confirmation

After confirming the appropriate information, click Save and Finish. You’ll receive a confirmation page confirming that “Jenkins is Ready!”:

jenkins_ready_page_two
jenkins_ready_page_two

Click Start using Jenkins to visit the main Jenkins dashboard:

jenkins_home_page
jenkins_home_page

At this point, you have completed a successful installation of Jenkins.

Conclusion

In this tutorial, we have learned how to install and use Jenkins in ubuntu 22.04.

Recommended Linux Ubuntu Tutorials

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published. Required fields are marked *