Jenkins is an open-source automation server that is widely used by DevOps teams to streamline the continuous integration and delivery (CI/CD) process. If you are a systems administrator and you are looking to install Jenkins on Rocky Linux 9, then you are in the right place. In this blog post, we will cover how to install Jenkins on Rocky Linux 9, and also cover any initial configuration required.
Before we begin, make sure that you have root access to your Rocky Linux 9 system. Without further ado, let’s get started.
Install Java
Jenkins requires Java to run, so the first thing we need to do is to install Java on our Rocky Linux 9 system. Run the following command to install Java:
sudo dnf install java-11-openjdk
BashInstall Jenkins
Once Java is installed, we can proceed to install Jenkins. Run the following commands to install wget, add the Jenkins repository and key to your system and ultimately install Jenkins:
sudo dnf install wget
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
sudo dnf install jenkins
BashStart Jenkins and Enable It to Start on Boot
After Jenkins is installed, we need to start the Jenkins service and enable it to start on boot. Run the following commands to start the Jenkins service and enable it to start on boot:
sudo systemctl start jenkins
sudo systemctl enable jenkins
BashConfigure the Firewall
Jenkins uses port 8080 by default, so we need to configure the firewall to allow traffic on this port. Run the following command to open port 8080:
sudo firewall-cmd --zone=public --add-port=8080/tcp
sudo firewall-cmd --runtime-to-permanent
sudo firewall-cmd --reload
sudo firewall-cmd --list-ports
BashAccess Jenkins
Now that Jenkins is installed and configured, we can access it using a web browser. Open a web browser and navigate to the following URL:
http://your-server-ip-address:8080
BashReplace “your-server-ip-address” with the IP address of your Rocky Linux 9 system. You should see the Jenkins login page.
Initial Configuration
The first time you access Jenkins, you will be prompted to unlock it. To do this, you need to retrieve the initial admin password. Run the following command to retrieve the initial admin password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
BashCopy the password and paste it into the “Administrator password” field on the Jenkins login page. Click “Continue” to proceed.
Next, Jenkins will ask you to install some plugins. You can either choose to install the recommended plugins or select the plugins that you need. Once you have made your selection, click “Install” to proceed.
After the plugins are installed, you will be asked to create an admin user. Fill in the required fields and click “Save and Finish” to complete the initial configuration.
Conclusion
In this blog post, we have covered how to install Jenkins on Rocky Linux 9 and also covered any initial configuration required. By following these steps, you should now have Jenkins up and running on your Rocky Linux 9 system. Jenkins is a powerful tool that can help streamline your CI/CD process, so it is definitely worth investing some time into learning how to use it.