This article will provide you the step-by-step guide on how to install Jenkins on CentOS 8:
DevOps Full Course Tutorial for Beginners - DevOps Free Training Online
Docker Full Course Tutorial for Beginners - Docker Free Training Online
Kubernetes Full Course Tutorial for Beginners - Kubernetes Free Training Online
Ansible Full Course Tutorial for Beginners - Ansible Free Training Online
Openstack Full Course Tutorial for Beginners - Openstack Free Training Online
Steps to Install Jenkins on CentOS 8
Step 1: Update the SystemBefore installing Jenkins, it's essential to ensure your CentOS system is up to date. Open your terminal and run the following commands:
sudo yum update
Step 2: Install JavaJenkins requires Java to run. You can install OpenJDK, which is open-source and compatible with Jenkins:
sudo yum -y install java-11-openjdk-develAfter the installation is complete, verify the Java version:
Step 3: Add Jenkins RepositoryTo install the latest version of Jenkins, add the Jenkins repository:
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io-2023.key
Step 4: Install JenkinsNow, you can install Jenkins using the following command:
sudo yum -y install jenkins
Step 5: Start and Enable JenkinsOnce Jenkins is installed, start the service and enable it to start on boot:
sudo systemctl start jenkins
sudo systemctl enable jenkins
Step 6: Check Jenkins StatusTo verify that Jenkins is running, use the following command:
sudo systemctl status jenkinsYou should see a message indicating that Jenkins is active and running.
Step 7. Allow Port 8080 on Firewall:If you have firewalld enabled on your server, then we must allow our Jenkins default port 8080 to make it accessible from network, if not we can ignore this step.
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
Step 8: Unlock JenkinsJenkins is initially locked, and you need to retrieve the initial admin password to unlock it. Run this command to get the password:
sudo cat /var/lib/jenkins/secrets/initialAdminPasswordThis command will display the password you need to unlock Jenkins. Copy it.
Step 9: Access Jenkins Web InterfaceOpen a web browser and enter your server's IP address followed by port 8080, like this: http://your_server_ip:8080.
You will be prompted to enter the initial admin password obtained in Step 7. Paste the password and click "Continue."
Step 10: Install Recommended PluginsSelect the "Install suggested plugins" option. Jenkins will begin downloading and installing the required plugins.
Step 11: Create an Admin UserAfter the plugins are installed, you'll be prompted to create an admin user. Fill in the required details.
Step 12: Start Using JenkinsOnce you've completed the setup, Jenkins is ready to use. You can start creating and managing your Jenkins jobs to automate your development workflows.
By following these steps, you've successfully installed Jenkins on your CentOS 8 server, and you're now ready to harness its automation capabilities for your projects.
Additional Configurations on Jenkins:
cat /etc/passwd | grep -i jenkins
jenkins ALL=(ALL) NOPASSWD: ALLDefaults !requiretty
Change Jenkins user shell:
cat /etc/passwd | grep -i jenkins
jenkins:x:995:992:Jenkins Automation Server:/var/lib/jenkins:/bin/bash
sudo systemctl restart jenkins
Related Searches and Questions asked: