CI/CD is now an integral part of the software development as we need to release changes to the market very frequently. For the implementation of the CI/CD, Jenkins is the most used software and has various plug-ins and large community support.
Jenkins is a Java-based server for build, test and deploy applications automatically, this can be deployed on and Java-supported OS.
In this article, I will tell you about the steps to install Jenkins on Ubuntu 20. One can also run it directly from docker.
Pre-Requisites of Jenkins
To run Jenkins you need only Java as it is a Java-based system, so first, you need to check Java is installed on your ubuntu or not.
$ java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)
If there is no java installation then install Open JFK 11 using the following command
$ sudo apt install openjdk-11-jdk
After installation checks again java version to verify Java installation.
Installation of Jenkins
For installation, you can refer official Jenkins page for Debian based system. Check Debian Jenkins Packages
This is the Debian package repository of Jenkins to automate installation and upgrade. To use this repository, first, add the key to your system using the following command
$ wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
After this add a Jenkins apt repository entry
$ sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
Update your local package index, then finally install Jenkins
$ sudo apt-get update
$ sudo apt-get install jenkins
It will install Jenkins and you can access it from your browser over 8080 port. It will ask initial admin password generated in the installation location.
Copy password from the location displayed and enter on screen. After this, it will proceed to install plug-ins with the option install suggested or select to install. You can proceed with either option and install the required plugins later.
After this, it will ask to create an admin user. Create a user with as required information. Then it will ask to set up Jenkins URL, change it or keep it to the default.
Now Jenkins is ready to use.
You can set up build agents on other nodes or systems or for development purposes you can use the Jenkins server system only as build system.