#
Jenkins installation on Linux (CentOS 8)
Info
This tutorial presents the installation of Jenkins 2.375.1 on Linux (CentOS 8).
#
Prerequisites
Minimum hardware requirements:
- 256 MB of RAM
- 1 GB of drive space (although 10 GB is a recommended minimum if running Jenkins as a Docker container)
Recommended hardware configuration for a small team:
- 4 GB+ of RAM
- 50 GB+ of drive space
For more details you can take a look on the official Jenkins site.
On CentOs 8, the first step is to create the group and the user which will manage the Jenkins installation:
groupadd jenkins
useradd -g jenkins jenkins
passwd jenkins
We can create a directory where we will keep different artifacts later (but this is not a mandatory step):
mkdir -p /u01/jenkins
chown -R jenkins: jenkins /u01/jenkins
We can install wget and other tools we will need in the future (wget is mandatory, the others are optional).
yum -y install wget curl
Install Java 17 on the machine :
dnf -y install java-17-openjdk java-17-openjdk-devel
Info
Jenkins requires Java 11 or 17 since Jenkins 2.357 and LTS 2.361.1
#
Get Jenkins repository to your system
By default, the Jenkins package is not included in the CentOS 8 default repository. So you will need to add the Jenkins repo to your system. You can add it using the following command:
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
#
Import Jenkins GPG Key
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
#
Installation steps
Start Jenkins installation on Linux/ CentOS 8 :
dnf install -y jenkins
... and Linux will be installed immediately :
Warning
This installation was done under the root account, but generally the installation is done under another user (like jenkins) in order to avoid the over utilization of the root account which is used for Linux administration only in real live. More rights must be granted to jenkins user in this case. Using root is simpler, but not secure.
It is better to enable the Jenkins service to start at boot :
systemctl enable jenkins
Start the Jenkins service :
systemctl start jenkins
Check the status of the Jenkins service :
systemctl status jenkins
The result will be something like this:
Jenkins is work on port 8080 so we need to allow connections on that port by adding it in firewall:
firewall-cmd --zone=public --permanent --add-port=8080/tcp
firewall-cmd --reload
In order to test the installation you need to go the http://localhost:8080 . The following page will be displayed:
Take a look in this file and take the Jenkins admin password in /var/lib/jenkins/secrets/initialAdminPassword. Enter the password into that page and you will see the following page:
Click on "Install suggested plugins" and the most used plugins will be installed. You will see a page as below:
When the installation is completed you will be prompted to create your first admin user.
I will skip this step for now. The following page will be displayed:
Click on "Save and Finish" and the installation is done. You will see the following on the screen:
When you press on "Start using Jenkins" you will see Jenkins console.
Enjoy Jenkins installation on Linux/CentOS !