Jenkins, a well-known automation server, helps to automate your software projects like building, testing, and deploying your projects. Before getting into details, let’s look at some of the distinctive features of Jenkins:
- Jenkin can be used as a simple CI server, or it can be set as a hub for the project
- It is a Java-based program. It can be installed easily on different known operating systems.
- User can configure it by the web interface after installing it.
- It comes with hundreds of plugins that can help developers to automate their projects.
- It can be extended using its architecture plugins that can operate on several machines.
This blog will demonstrate the installation of Jenkins and provide a getting started guide. The content of this post is as follows:
Let’s start with the first:
How to Install Jenkins on Ubuntu 22.04?
This section contains recommended steps for installing Jenkins on Ubuntu 22.04. Follow them one by one to get Jenkins:
Step 1: Install Java
As Jenkins is a Java-based program, so first, we will install the Java package on Ubuntu using the command:
$ sudo apt install default-jdk -y
To verify the installation of Java, check its version using the command as follows:
$ java --version
Step 2: Add GPG Key of Jenkins
Add the Jenkins’s official GPG key to add the Jenkins repository securely:
$ curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee \ /usr/share/keyrings/jenkins-keyring.asc > /dev/null
Step 3: Add Jenkins Repository
After that, add the repository of Jenkins to Ubuntu using the command:
$ 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: Update the Ubuntu Packages List
Update the packages and repository of Ubuntu using the command:
$ sudo apt update
Step 5: Install Jenkins
Once the repository is added, you can install Jenkins using the “apt” package manager:
$ sudo apt install jenkins -y
Jenkins is installed successfully.
How to Started Jenkins on Ubuntu 22.04?
When the package Jenkins has been installed on Ubuntu 22.04, you need to configure Jenkins before using it. To do so, the following steps are carried out:
Step 1: Configure the Jenkins Service
Firstly, enable the Jenkins service so that you may not face any trouble on every reboot:
$ sudo systemctl enable jenkins
Then, start the Jenkins using the systemctl command:
$ sudo systemctl start jenkins
Finally, confirm the active status of Jenkins service as follows:
$ sudo systemctl status jenkins
Step 2: Allow Traffic on Port 8080
Jenkins uses port “8080” for its operations. So, we will first allow the traffic on port 8088 with the ufw utility:
$ sudo ufw allow 8080
Step 3: Enable Firewall
Enable the UFW service by using the command:
$ sudo ufw enable
Confirm the status of UFW and changes made by running the command:
$ sudo ufw status
Step 4: Check Jenkins Password
We will open the file of Jenkins to get its password that will be used to log in the Jenkins on the web. The following command uses the “nano” editor to access the “initialAdminPassword” file of Jenkins:
$ sudo nano /var/lib/jenkins/secrets/initialAdminPassword
Copy the password so that it can be used to log in to the web.
Step 5: Open Jenkins Web Interface
Open the browser and access your localhost via Port 8080 (or use the URL https://localhost:8080):
Paste the password which we had copied earlier:
Then choose “Install suggested plugins” and wait for a while till the plugins are installed on the computer:
Now click on “Start using Jenkins”:
Here, we come to the dashboard of Jenkins:
From the dashboard, one can start using Jenkins service to track project progress, share the project with other stakeholders, or to get the overall build history of the project.
That’s all from this informative Jenkins guide!
To start using Jenkins, you need to install Jenkins first. After that, configure the service of Jenkins and firewall settings to access the Jenkins web interface. Jenkins is an automation server containing plenty of plugins for helping developers to test, build, and deploy their projects. In this write-up, the complete installation method of Jenkins with its configuration has been explained. These steps enable you to start using Jenkins to automate your software projects.
TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY