In this article, we will acquire a knowledge of how-to setup the Jenkins on CentOS 8 or RHEL 8. We will also go through why there is a need of an additional tool for delivering a project. But before we start with all gun blazing and put this tool to work, we should know what it is exactly and why it is needed.
Jenkins is an open-source software for continuous software development. It is based on Java and it is the only tool which can be used in every part of software development cycle.
What is Jenkins ?
Jenkins is a CI/CD tool. Here CI means continuous integration and CD means continuous delivery. Jenkins is also considered as automation tool or server, It helps to automate software development which are related to building, testing and deploying. It is a server-based tool which runs on servlet containers like Apache Tomcat.
Why do we need Jenkins tool?
As maximum organization is now having agile process. Agile methodology is a practice that promotes both continuous integration and continuous delivery, it has scrum process that can be of 2/3 weeks, which is also known as scripts. In every sprint developers and tester has to do continuous development and testing with continuous integration and continuous delivery. In every sprint client get the privilege to check that the software/application is building according to the given requirement. They also have the leverage to change/update the requirement according to their business needs. This is one of the main reasons why Jenkins is one of the most popular tools in the market nowadays.
Prerequisites:
- Minimal CentOS 8 / RHEL 8
- User with sudo rights
- Stable Internet Connection
- For RHEL 8 system, active subscription is required.
Jenkins Lab details:
- Host Name: Jenkins.linuxtechi.com
- IP Address: 192.168.1.190
- SELinux : Enabled
- Firewall: Running
Installation Steps of Jenkins on CentOS 8 / RHEL 8
Step 1) Update hosts file and apply updates
Add the following hostname entry in /etc/hosts file, run below echo command:
[pkumar@jenkins ~]$ echo "192.168.1.190 jenkins.linuxtechi.com" | sudo tee -a /etc/hosts
Install all the available updates using the beneath dnf command,
[pkumar@jenkins ~]$ sudo dnf update -y
Once all the updates are installed successfully then reboot your system once.
[pkumar@jenkins ~]$ sudo reboot
Step 2) Enable Jenkins Package Repository
Run the following command to enable Jenkins package repository for CentOS 8 / RHEL 8,
[pkumar@jenkins ~]$ sudo dnf install wget -y [pkumar@jenkins ~]$ sudo wget http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo -O /etc/yum.repos.d/jenkins.repo
Run below rpm command to import GPG key for Jenkins packages
[pkumar@jenkins ~]$ sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
Step 3) Install Java and Jenkins with dnf command
Java is one of the perquisites for Jenkins, so run below dnf command to install java
[pkumar@jenkins ~]$ sudo dnf install -y java-11-openjdk-devel
Verify the java version using below command:
pkumar@jenkins ~]$ java --version
Now install Jenkins using beneath dnf command,
[pkumar@jenkins ~]$ sudo dnf install -y jenkins
Step 4) Start and Enable Jenkins Service via systemctl
Run following systemctl command to start and enable Jenkins service
[pkumar@jenkins ~]$ sudo systemctl start jenkins [pkumar@jenkins ~]$ sudo systemctl enable jenkins
Verify Jenkins service status by running following command,
[pkumar@jenkins ~]$ sudo systemctl status jenkins
Above output confirms that Jenkins service is active and running.
Step 5) Configure firewall rules for jenkins
Allow 8080 tcp port in OS firewall for Jenkins, run following firewall-cmd commands,
[pkumar@jenkins ~]$ sudo firewall-cmd --permanent --add-port=8080/tcp [pkumar@jenkins ~]$ sudo firewall-cmd --reload
Step 6) Setting Up Jenkins with Web Portal
In this step, we will setup the Jenkins via its web portal, access its portal from the browser and type the URL:
http://<Server-IP>:8080
The browser displays the unlock Jenkins page. It will ask to enter temporary password. To retrieve this password run following cat command from the terminal,
[pkumar@jenkins ~]$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword 802dffd0fbb74fa2bde9e6c1264a5f10 [pkumar@jenkins ~]$
Copy and paste the password into the password field and then click on continue.
Jenkins will now ask to install plugins. There will be two options ‘Install using suggested plugins‘ or ‘Select plugins to install‘. It is recommended to go with ‘Install using suggested plugins ‘. So Click on the first option
Once all the suggested plugins are installed then setup wizard will prompt us to create admin user.
Click on ‘Save and Continue‘
Click on ‘Save and Finish’
Click on ‘Restart’, Once Jenkins is restarted then we will get following login page:
Use the same user credentials that we have created during the Jenkins setup.
Above screen confirms that Jenkins has been installed successfully. That’s all from this article, please do share your feedback and comments.
The post How to Setup Jenkins on CentOS 8 / RHEL 8 first appeared on Linuxtechi.
from Linuxtechi https://ift.tt/3hTucc1
0 Comments