Jenkins is the most popular, open source, Java-based automation server, which allows you to easily set up a continuous integration and continuous release pipeline.
Continuous Integration (CI) is a DevOps practice. When team members submit code to the version control warehouse normally, automated builds and tests are run. Continuous release (CD) is a series of practices. When the code is modified, it is automatically built, tested, and released to the production environment.
This tutorial will involve some steps to install Jenkins from the official Jenkins repository on CentOS 8.
As root or another user with sudo privileges, perform the following steps to install Jenkins on CentOS 8.
We will install OpenJDK 8:
sudo dnf install java-1.8.0-openjdk-devel
If you have installed multiple versions of Java in your system, please make sure that Java 8 is the default Java version.
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum install jenkins
Once the installation process is complete, start the Jenkins service and enable the startup function:
sudo systemctl start jenkins
sudo systemctl enable jenkins
To check whether Jenkins is running, type:
systemctl status jenkins
The output should look like this:
Loaded:loaded(/etc/rc.d/init.d/jenkins; generated)
Active:active(running) since Thu 2019-10-3121:31:36 UTC; 3s ago
...
If you have installed Jenkins on a remote CentOS server protected by a firewall, you need to open the port number 8080
.
Use the following command to open the necessary ports:
sudo firewall-cmd --permanent --zone=public--add-port=8080/tcp
sudo firewall-cmd --reload
To start Jenkins setup, first open your browser, and enter the domain name or server IP address, plus the port number 8080
:
http://your_ip_or_domain:8080
An interface similar to the following will appear, prompting you to enter the super administrator password created during the installation process:
Use cat
to display the password in the terminal:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
You will see a 32-bit alphanumeric password, like the following:
e1bc55ea402640c58970b8db41e4f3bc
Copy the password of the terminal, paste it into the "Administrator Password" text area, and click "Continue".
On the next screen, you will be asked if you want to install the suggested plugins or choose the plugins to install yourself. Click "Install suggested plugins" and the installation process will begin.
Once the installation is complete, you will be prompted to set up the first administrator user. Fill in all required information and click "Save and Continue".
On the next page, the installer will ask you to set the address of the Jenkins instance. The URL text area is filled with an automatically generated URL.
To complete the steps, confirm the URL, and click the "Save and End" button.
Finally, click the "Start using Jenkins" button, and you will be redirected to the Jenkins backend (the backend you logged in with the administrator account created in the previous step).
If you get here, you have successfully installed Jenkins on your CentOS system.
In this tutorial, we showed how to install Jenkins on CentOS/RHEL and complete the initial configuration.
You can now browse Jenkins official documentation, and start exploring the workflow and plug-in mode of Jenkins.
Recommended Posts