How to install Jenkins on CentOS

This tutorial provides steps for installing Jenkins on CentOS

Check Java installation

[[email protected] ~]# java --version
-bash: java: command not found

As Java is not installed, so first install Java

[[email protected] ~]# yum install java-1.8.0-openjdk
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors

Verify Java installation

[[email protected] ~]# java -version

openjdk version "1.8.0_272"
OpenJDK Runtime Environment (build 1.8.0_272-b10)
OpenJDK 64-Bit Server VM (build 25.272-b10, mixed mode)
[[email protected] ~]#

Download Jenkins repository

[[email protected] ~]# wget -O /etc/yum.repos.d/jenkins.repo

--2020-11-15 19:52:08--
Resolving (, 2a04:4e42:25::645
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 85
Saving to: ‘/etc/yum.repos.d/jenkins.repo’

100%[==============================================================================================================================>] 85          --.-K/s   in 0s

2020-11-15 19:52:08 (7.37 MB/s) - ‘/etc/yum.repos.d/jenkins.repo’ saved [85/85]

Import gpg key

[[email protected] ~]# rpm --import
[[email protected] ~]#

Update yum packages

[[email protected] ~]# yum update
Loaded plugins: fastestmirror, langpacks

Install Jenkins

[[email protected] ~]# yum install jenkins

Reload systemd manager configuration

[[email protected] ~]# systemctl daemon-reload

Start Jenkins server

[[email protected] ~]# systemctl start jenkins

Check Jenkins server status

[[email protected] ~]# systemctl status jenkins
● jenkins.service - LSB: Jenkins Automation Server
   Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
   Active: active (running) since Sun 2020-11-15 21:42:23 IST; 31s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 14358 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/jenkins.service

If you are able to see output similar to as shown above, than Jenkins is successfully installed.

Allow tcp connections on port 8080 for Jenkins

[[email protected] ~]# sudo firewall-cmd --zone=public --permanent --add-port=8080/tcp
[[email protected] ~]# sudo firewall-cmd --reload

Now on browser navigate to http://"your-server-IP-or-hostname":8080, you should see Jenkins getting started screen

Retrieve the default generated password from below path and set up Jenkins with Plugins

[[email protected] ~]# cat /var/lib/jenkins/secrets/initialAdminPassword

Similar Articles