Skip to main content
install jenkins on CentOS

How To Install Jenkins on CentOS Servers

What is Jenkins?

Jenkins is an Open Source tool that provides continuous integration and continuous delivery services for software development. The basic functionality of Jenkins is to execute a predefined list of steps based on time or an event. I.e, for example, every half an hour or after a new commit in a Git repository. Additionally, it is possible to extend the functionalities of Jenkins with the help of plugins. Jenkins also monitors the execution of the steps and allows to stop the process if one of the steps fails. It will then send out notification about the build status. In this article, I will show you how to install Jenkins on CentOS 6/7.

How To Install Jenkins on CentOS 6.x/7.x?

Step 1: Update your CentOS system

First, update the system packages by running “yum update” and reboot the server.

yum update
shutdown -r now

Step 2: Install Java

Now, install Java on and set the environment variables.

yum install java-1.8.0-openjdk-devel.x86_64

You can check the java version by running the following command:

java -version

Next, we need to set up the Java environment variables.

cp /etc/profile /etc/profile_orig
echo -e "export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk" >> /etc/profile
echo -e "export JRE_HOME=/usr/lib/jvm/jre" >> /etc/profile
source /etc/profile

Now, verify that the Java environment variables are set up properly by running the following command:

echo -e "$JAVA_HOME\n$JRE_HOME"

Step 3: Install Jenkins

Now, install the latest version of Jenkins using the repository.

Install wget on your server if it’s not present:

yum install wget -y

Now, add the Jenkins repository to your server.

wget -O /etc/yum.repos.d/jenkins.repo
rpm --import

Install Jenkins.

yum install jenkins -y

Step 4: Start Jenkins

Now start Jenkins using:

/etc/init.d/jenkins start         # RHEL 6/CentOS 6
systemctl start jenkins.service   # RHEL 7/CentOS 7

You can then set Jenkins to run at boot time using the following command:

chkconfig jenkins on              # RHEL 6/CentOS 6
systemctl enable jenkins.service  # RHEL 7/CentOS 7

That’s it. You can now access the Jenkins using http://<ip_address>:8080/

The default Jenkins admin password will be stored in the below file.

Rate this post


TheGeeksAlive is all about Linux, Server Administration, Web Hosting and other Open Source Technologies.