Step-by-Step Guide
- Update the Package Index
Open a terminal and update the package index to ensure you have the latest information about available packages:
sudo yum update -y
- Install Java
Jenkins requires Java to run. Install OpenJDK, which is a free and open-source implementation of the Java Platform:
sudo yum install java-11-openjdk-devel -y
Verify the Java installation:
java -version
- Add Jenkins Repository
Add the Jenkins repository to your system:
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
- Install Jenkins
Install Jenkins using theyum
package manager:
sudo yum install jenkins -y
- Start and Enable Jenkins
Start the Jenkins service:
sudo systemctl start jenkins
Enable Jenkins to start on boot:
sudo systemctl enable jenkins
- Adjust the Firewall
Ensure that your firewall allows traffic on port 8080, which is the default port for Jenkins. If you are using firewalld, you can allow traffic with:
sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp
sudo firewall-cmd --reload
- Verify Jenkins Installation
Check the Jenkins service status to ensure it is running:
sudo systemctl status jenkins
If Jenkins is running, you should see an active (running) status.
- Access Jenkins Web Interface
Open your web browser and navigate tohttp://your_server_ip:8080
. You should see the Jenkins unlock screen. - Unlock Jenkins
Retrieve the initial administrator password by running the following command:sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the password and paste it into the “Administrator password” field in the Jenkins web interface. - Install Suggested Plugins
After unlocking Jenkins, you will be prompted to install plugins. Click on “Install suggested plugins” to start the installation process. - Create First Admin User
Once the plugins are installed, you will be prompted to create the first admin user. Fill in the required information and click “Save and Finish”. - Start Using Jenkins
After creating the admin user, Jenkins is ready to use. Click on “Start using Jenkins” to access the Jenkins dashboard. - Configure Jenkins (Optional)
Configure Jenkins according to your needs. You can install additional plugins, set up credentials, and configure global settings from the Jenkins dashboard. - Set Up a Simple Job (Optional)
To set up a simple job, click on “New Item” in the Jenkins dashboard, enter a name for your job, select “Freestyle project”, and click “OK”. Configure the job settings and click “Save”. To run the job, click on “Build Now”.