How you can install Jenkins on a CentOS 7 or RHEL 7 system
Install OpenJDK 8 package
sudo yum install java-1.8.0-openjdk-devel
- Start by adding the Jenkins repository to your system's package manager:
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
- Import the repository's GPG key:
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
- Install Jenkins and its dependencies:
sudo yum install jenkins
- Start the Jenkins service and enable it to start automatically on boot:
sudo systemctl start jenkins
sudo systemctl enable jenkins
- If you have a firewall enabled, you will need to open port 8080 to allow access to the Jenkins web interface:
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
- Finally, you can access the Jenkins web interface by navigating to http://<your-server-ip>:8080 in a web browser.
Note: If you are using SELinux you need to set the correct context for the jenkins files, you can use the following command:
sudo chcon -R -t httpd_sys_content_t /var/lib/jenkins
Note: If you are using a proxy to connect to internet, you should configure jenkins to use the proxy.