From this article we will Learn how to “Deploy Jenkins on Ubuntu 20.04/22.04 LTS”.
Introduction:
At its core, Jenkins is an automation server that simplifies the software development process through automation. It was initially developed as an open-source alternative to the proprietary Hudson project. Today, it stands as one of the most widely adopted CI/CD tools, trusted by organizations ranging from startups to Fortune 500 companies. Installing Jenkins on Ubuntu 20.04/22.04 is a straightforward process. Jenkins is a popular open-source automation server that is widely used for building, deploying, and automating projects. In this blog article, we’ll walk you through the steps to install Jenkins on Ubuntu 20.04/22.04.
Prerequisites:
- A running Ubuntu 20.04/22.04 server or desktop system.
- Administrative access (sudo or root) to the Ubuntu system.
- Java must be installed on Ubuntu 20.04/22.04 LTS.
- We need to add 8080 port number in Security inbound rules.
Let’s see how to “Deploy Jenkins on Ubuntu 20.04/22.04 LTS”.
Steps for “Deploy Jenkins on Ubuntu 20.04/22.04 LTS”
Step #1: Update Your Ubuntu 20.04/22.04 LTS
Before you begin, it’s a good practice to update your system to ensure you have the latest packages and security updates. Open a terminal and run the following commands:
ubuntu@Rushi-InfoTech:~$ sudo apt-get update
Step #2: Install Java on Ubuntu 20.04/22.04 LTS
Jenkins is built using Java, so you need to install Java on your system. OpenJDK is a commonly used open-source implementation of Java. Install it using the following command:
ubuntu@Rushi-InfoTech:~$ sudo apt install openjdk-11-jdk
After the installation is complete, you can check the Java version by running:
ubuntu@Rushi-InfoTech:~$ java -version
You should see output indicating that OpenJDK is installed.
Step #3: Add Jenkins Repository using Curl
This is the Debian package repository of Jenkins to automate installation and upgrade. To use this repository, first add the key to your system:
ubuntu@Rushi-InfoTech:~$ curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \ /usr/share/keyrings/jenkins-keyring.asc > /dev/null
Then add a Jenkins apt repository entry:
ubuntu@Rushi-InfoTech:~$ echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \ https://pkg.jenkins.io/debian-stable binary/ | sudo tee \ /etc/apt/sources.list.d/jenkins.list > /dev/null
Step #4: Install Jenkins
Now, you can install Jenkins using the following commands:
- You need to update your Ubuntu 20.04/22.04 LTS.
ubuntu@Rushi-InfoTech:~$ sudo apt-get update
- Now, You can install Jenkins on Ubuntu 20.04/22.04 LTS.
ubuntu@Rushi-InfoTech:~$ sudo apt install jenkins
During the installation, you will be prompted to confirm the installation and allow Jenkins to be started as a system service.
- To check the Jenkins Status:
ubuntu@Rushi-InfoTech:~$ sudo service jenkins status
Step #5: Configure Firewall (optional)
If you happen to be using ufw firewall for Ubuntu, open port 8080 on the firewall
ubuntu@Rushi-InfoTech:~$ sudo ufw enable
ubuntu@Rushi-InfoTech:~$ sudo ufw allow 8080
ubuntu@Rushi-InfoTech:~$ sudo ufw status
ubuntu@Rushi-InfoTech:~$ sudo ufw allow ssh
ubuntu@Rushi-InfoTech:~$ sudo ufw status
Step #6: Configuring Jenkins
Jenkins runs on port 8080 by default. You can access the Jenkins web interface by opening a web browser and navigating to http://your_server_ip_or_domain:8080
.
You will need to retrieve the initial administrator password to unlock Jenkins. Run the following command to get the password:
ubuntu@Rushi-InfoTech:~$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the provided password and paste it into the Jenkins setup wizard on the web interface.
Step #7: Install Recommended Plugins
In the Jenkins setup wizard, you can choose to install recommended plugins or select plugins manually. For most users, it’s recommended to choose the “Install suggested plugins” option. This will install the plugins that are commonly used for Jenkins tasks.
It will take few seconds to install the plugins into the jenkins.
Step #8: Create an Admin User
After the plugin installation, you will be prompted to create an admin user. Fill in the required information and click “Save and Continue.”
Step #9: Configure Jenkins URL
Jenkins will suggest a URL based on your server’s hostname. Ensure that this URL is correct and click “Save and Finish.”
Step #10: Start Using Jenkins
Jenkins is now installed and ready to use. Click on “Start using Jenkins”.
You can start creating and managing your automation pipelines and jobs from the Jenkins dashboard.
Remember to keep Jenkins and its plugins updated for security and feature enhancements.
Conclusion:
That’s it! You’ve successfully installed Jenkins on Ubuntu 20.04/22.04. You can now begin automating your development and deployment processes with Jenkins.
From this article we have learnt how to ” Deploy Jenkins on Ubuntu 20.04/22.04 LTS”.
Related Articles:
How to Setup EKS cluster using eksctl
Reference:
Any queries pls contact us
https://rushiinfotech.in/contact/