Jenkins is an open-source automation server that automates the repetitive tasks involved in continuous integration and delivery of software. We can also change the default port of Jenkins in ubuntu. Let’s see, how to install the Jenkins server. This article shows you how to install jenkins on ubuntu 20.04.
We Recommend the following hardware configuration for a small team.
1 GB+ of RAM
50 GB+ of drive space
We can easily install the Jenkins Automation tool on ubuntu using official repository. you can also download the latest version of Jenkins using following commands.
Firstly, add the repository key:
$ sudo wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
when key is added, we will get the following output:
Now append the package repository address to the server’s sources.list:
$ sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
Now we need to update system using the below commands.
$ sudo apt update
Finally, install Jenkins and its dependencies using following commands:
$ sudo apt install jenkins
Start Jenkins using systemctl utility.
$ sudo systemctl start jenkins
$ sudo systemctl enable jenkins
$ sudo systemctl status jenkins
If everything went well, the beginning of the output should show that the service is active (exited).
jenkins.service - LSB: Start Jenkins at boot time Loaded: loaded (/etc/init.d/jenkins; generated) Active: active (exited) since Mon 2020-08-16 18:22:08 UTC; 6min ago Docs: man:systemd-sysv-generator(8) Tasks: 0 (limit: 1153) CGroup: /system.slice/jenkins.service
Open default port in the Firewall
By default, Jenkins runs on port 8080, so we will open port using ufw utility:
$ sudo ufw allow 8080
Check the status of ufw to confirm the newly added rules:
$ sudo ufw status
Setting up Jenkins
Now visit Jenkins on its default port to complete it’s setup, using IP address or server domain name: http://ip_addr_or_domain:8080
Now get the Administrator password using the following command and paste it in the console then click on “Continue“.
$ cat /var/lib/jenkins/secrets/initialAdminPassword
Here we will get next screen asking “Install Suggested plugins” and “Select plugins to install“.
We will opt first option “Install Suggested plugins” which will immediately begin the installation process.
Once the installation is finished. we have to create an admin user to access Jenkins server. Now click on “Save and Continue“.
Enter the name and password for your user:
You will get an Instance Configuration page that asks you to confirm the preferred URL for Jenkins instance. If you wish to change the Jenkins URL, you can change it but I will go with the same URL and click on “Save and finish“.
Now you will get a confirmation page confirming that “Jenkins is Ready!”:
Click on “Start using Jenkins” to visit the main Jenkins dashboard.
Now you have finished a successful installation of Jenkins.
In this article you have learned how to install jenkins on ubuntu 20.04.