Hi, folks. In this post as a guide, you will learn how to install Jenkins on Ubuntu 20.04
Continuous integration and Jenkins
In a production environment, the software is developed and compiled frequently. In addition to this, it needs to be tested quite a few times. With each change in the source code, it is necessary to start the whole process over again.
Jenkins automates all these tasks quickly and easily. So, the process where all the changes and functions of the application in development are automatically verified is called continuous integration.
In this sense, using Jenkins the developer will know at all times the status of his application. Failures, new features, and processes will be automated and monitored with Jenkins.
Install Jenkins on Ubuntu 20.04
Because it is an application created in Java, Jenkins can be installed on any system that supports this programming language.
However, we will use a dedicated repository to make the installation even easier. Also, it will help to have recent versions of the application.
1.- Install Java on Ubuntu 20.04
Jenkins is made in Java, so the first step is to install Java on Ubuntu 20.04
Previously, only the application supported Java 8, but now it also supports Java 11.
So to install Java just run the following command:
:~$ sudo apt install openjdk-11-jre openjdk-11-jdk Reading package lists… Done Building dependency tree Reading state information… Done The following additional packages will be installed: at-spi2-core ca-certificates-java fonts-dejavu-extra java-common libatk-bridge2.0-0 libatk-wrapper-java libatk-wrapper-java-jni libatk1.0-0 libatk1.0-data libatspi2.0-0 libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libfontenc1 libgif7 libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0 libice-dev libice6 libllvm9 libnspr4 libnss3 libpciaccess0 libpcsclite1 libpthread-stubs0-dev libsensors-config libsensors5 libsm-dev libsm6 libvulkan1 libwayland-client0 libx11-dev libx11-xcb1 libxau-dev libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0 libxcb-shape0 libxcb-sync1 libxcb1-dev libxcomposite1 libxdamage1 libxdmcp-dev libxfixes3 libxft2 libxi6 libxinerama1 libxkbfile1 libxmu6 libxrandr2 libxrender1 libxshmfence1 libxt-dev libxt6 libxtst6 libxv1 libxxf86dga1 libxxf86vm1 mesa-vulkan-drivers openjdk-11-jdk-headless openjdk-11-jre-headless x11-common x11-utils x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev Suggested packages: default-jre libice-doc pcscd lm-sensors libsm-doc libx11-doc libxcb-doc libxt-doc openjdk-11-demo openjdk-11-source visualvm libnss-mdns fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei | fonts-wqy-zenhei fonts-indic mesa-utils The following NEW packages will be installed: at-spi2-core ca-certificates-java fonts-dejavu-extra java-common libatk-bridge2.0-0 libatk-wrapper-java libatk-wrapper-java-jni libatk1.0-0 libatk1.0-data libatspi2.0-0 libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libfontenc1 libgif7 libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0 libice-dev libice6 libllvm9 libnspr4 libnss3 libpciaccess0 libpcsclite1 libpthread-stubs0-dev libsensors-config libsensors5 libsm-dev libsm6 libvulkan1 libwayland-client0 libx11-dev libx11-xcb1 libxau-dev libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0 libxcb-shape0 libxcb-sync1 libxcb1-dev libxcomposite1 libxdamage1 libxdmcp-dev libxfixes3 libxft2 libxi6 libxinerama1 libxkbfile1 libxmu6 libxrandr2 libxrender1 libxshmfence1 libxt-dev libxt6 libxtst6 libxv1 libxxf86dga1 libxxf86vm1 mesa-vulkan-drivers openjdk-11-jdk openjdk-11-jdk-headless openjdk-11-jre openjdk-11-jre-headless x11-common x11-utils x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev 0 upgraded, 77 newly installed, 0 to remove and 0 not upgraded. Need to get 294 MB of archives. After this operation, 789 MB of additional disk space will be used. Do you want to continue? [Y/n]
Accept the installation and Java will be ready for work.
Also read:
How to install Oracle Java 14 on Ubuntu 20.04
2.- Install Jenkins on Ubuntu 20.04
Now you have to add the Jenkins repository. But first, add the GPG key to secure the repository. Make sure you have the package apt-transport-https
installed.
:~$ sudo apt install apt-transport-https
:~$ wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - OK
Now add the repository to the system’s source list:
:~$ sudo apt-add-repository "deb https://pkg.jenkins.io/debian-stable binary"
And then, he proceeds to install Jenkins in Ubuntu.
:~$ sudo apt update :~$ sudo apt install jenkins Reading package lists… Done Building dependency tree Reading state information… Done The following additional packages will be installed: daemon net-tools The following NEW packages will be installed: daemon jenkins net-tools 0 upgraded, 3 newly installed, 0 to remove and 47 not upgraded. Need to get 65.5 MB of archives. After this operation, 67.4 MB of additional disk space will be used. Do you want to continue? [Y/n]
Jenkins is handled in the system as a service. Therefore, you can check the status with the following command:
:~$ sudo systemctl status jenkins ● jenkins.service - LSB: Start Jenkins at boot time Loaded: loaded (/etc/init.d/jenkins; generated) Active: active (exited) since Thu 2020-05-14 05:32:17 UTC; 1min 45s ago Docs: man:systemd-sysv-generator(8) Tasks: 0 (limit: 506) Memory: 0B CGroup: /system.slice/jenkins.service May 14 05:32:10 osradar systemd[1]: Starting LSB: Start Jenkins at boot time… May 14 05:32:13 osradar jenkins[9478]: Correct java version found May 14 05:32:14 osradar jenkins[9478]: * Starting Jenkins Automation Server jenkins May 14 05:32:14 osradar su[9519]: (to jenkins) root on none May 14 05:32:14 osradar su[9519]: pam_unix(su-l:session): session opened for user jenkins by (uid=0) May 14 05:32:17 osradar jenkins[9478]: …done. May 14 05:32:17 osradar systemd[1]: Started LSB: Start Jenkins at boot time.
As you can see, everything is going well. If an error occurs, it is probably a question of a lack of RAM memory.
Jenkins takes the issue of security very seriously, therefore, the installer generates a temporary key to continue with the installation.
To show it, just run the following command:
:~ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
So, in my case, this is the password.
3596a99b1f384a9db3e0eab32c59fe1d
Also, it doesn’t have to be the same as mine.
3.- Complete the Jenkins installation
Now open your favorite web browser and go to http://your-server:8080
and complete the installation.
The first thing you will see is that you will be prompted for the temporary password that we have shown above.
Then, you will be able to customize the Jenkins installation. You can either install the recommended plugins or choose the ones you want. I have chosen the first option.
Then the installation of the plugins will start.
So, when it is finished, you will have to create the administrator user.
Now, you will see the configuration of the Jenkins instance.
Then, you will see this screen indicating that everything has gone well and that you can use Jenkins.
Finally, you will see the dashboard of Jenkins on Ubuntu 20.04
So, Jenkins is ready for the action.
Conclusion
Jenkins is a very important application in the current and facilitates many tasks dedicated to the life process of software. So, despite that, it is very easy to install in Ubuntu 20.04
So, please share this post, join our Telegram channel. And if you can, buy us a coffee.