Tuesday , July 27 2021

How to install Jenkins on CentOS 7

Jenkins is a Java-based open source automation server that provides an easy way to set up an integration and continuous delivery (CI / CD) pipeline.

This tutorial will guide you through the steps of installing Jenkins on a CentOS 7 system using the official Jenkins repository.


Before continuing with this tutorial, make sure you have logged in as a sudo user.

Installation of Jenkins

To install Jenkins on your CentOS system, follow these steps:

  1. Jenkins is a Java application, so the first step is to install Java. A The following command to install the OpenJDK 8 package:

    sudo yum installs java-1.8.0-openjdk-devel

    The current version of Jenkins does not yet support Java 10 (and Java 11). If you have multiple versions of Java installed on your computer, make sure that Java 8 is the default Java version.

  2. The next step is to enable the Jenkins repository. To do so, import the GPG key using the following curl up command:

    curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo

    And add the repository to your system with:

    sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
  3. Once the repository is enabled, install the latest stable version of Jenkins by typing:

    At the end of the installation process, start the Jenkins service with:

    sudo systemctl start jenkins

    To check if it started correctly:

    You should see something like this:

    sudo systemctl to enable Jenkins
    jenkins.service is not a native service, redirecting to / sbin / chkconfig.
    Running / sbin / chkconfig jenkins on

Adjust the firewall

If you install Jenkins on a remote CentOS server that is protected by a firewall, you need to port it 8080.

Use the following commands to open the necessary port:

sudo firewall-cmd --permanent --zone=public --add-port=8080/ tcp
sudo firewall-cmd --reload


Set up Jenkins

To configure your new installation of Jenkins, open your browser and type in your domain or IP address followed by the port 8080:

http: // your_ip_or_domain: 8080

A screen similar to the following will appear, asking you to enter the administrator password that is created during the installation:

Use the following command to print the password on the terminal:

sudo cat / var / lib / jenkins / secrets / initialAdminPassword

You should see a long 32-character alphanumeric password as shown below:


Copy the password from your terminal, paste it in the Administrator password field and click Go on.

On the next screen, you'll be asked if you'd like to install the recommended plug-ins or select specific plug-ins. Click on Install the suggested plugins box, and the installation process will start immediately.

Once the installation is complete, you will be prompted to configure the first administrative user. Fill in all the required information and click Save and continue.

On the next page you will be asked to set the URL for the Jenkins instance. The archived URL will be populated with an automatically generated URL.

To complete the configuration, confirm the URL by clicking on the Save and Finish button.

Finally, click on Start using Jenkins button and you will be redirected to the Jenkins dashboard registered as an admin user you created in one of the previous steps.

If you've reached this point, you've successfully installed Jenkins on your CentOS system.


In this tutorial, you learned how to install and complete the initial Jenkins setup on CentOS / RHEL-based systems. You can now visit the official Jenkins documentation page and start exploring Jenkins' workflow and plug-in model.

If you have any questions, please leave a comment below.

Source link

Leave a Reply

Your email address will not be published.