Jenkins is an open-source and leading continuous integration tool written in Java. It is an automation tool that helps you to builds and tests your software continuously and monitor the execution and status of remote jobs. It makes it easier for team members to regularly obtain the latest code. Jenkins is just a framework, it achieves continuous integration with the help of plugins. It supports over 1000+ plugins.
Jenkins is written in Java So Java must be installed on your server. If not installed, you can install it using the following command:
dnf install java-11-openjdk -y
After installing Java, you can verify the Java installation with the following command:
java --version
You should see the following output:
openjdk 11.0.12 2021-07-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.12+7-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7-LTS, mixed mode, sharing)
Add Jenkins Repo
By default, the Jenkins package is not included in the CentOS 8 default repository. So you will need to add the Jenkins repo to your system. You can add it using the following command:
It is also recommended to secure your Jenkins website with Let’s Encrypt free SSL. To do so, you will need to install the Certbot client to manage the SSL certificates. You can install it using the following command:
Once the Certbot client has been installed, run the following command to install the Let’s Encrypt SSL for your Jenkins website:
certbot --nginx -d jenkins.yourdomain.com
You will be asked to accept the term of service and provide your valid email address to install the Let’s Encrypt SSL:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices)
(Enter 'c' to cancel): hitjethva@gmail.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Account registered.
Requesting a certificate for jenkins.yourdomain.com
Performing the following challenges:
http-01 challenge for jenkins.yourdomain.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/conf.d/jenkins.conf
Redirecting all traffic on port 80 to ssl in /etc/nginx/conf.d/jenkins.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://jenkins.yourdomain.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Subscribe to the EFF mailing list (email: hitjethva@gmail.com).
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/jenkins.yourdomain.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/jenkins.yourdomain.com/privkey.pem
Your certificate will expire on 2021-06-09. To obtain a new or
tweaked version of this certificate in the future, simply run
certbot again with the "certonly" option. To non-interactively
renew *all* of your certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
Configure Firewall
If a firewalld firewall is installed on your server. You will need to allow ports 80 and 443 through the firewalld. You can allow them using the following command:
Next, reload the firewalld service to apply the changes:
firewall-cmd --reload
Access Jenkins Web Installation Wizard
At this point, Jenkins is installed and configured. Now, open your web browser and access the Jenkins setup wizard using the URL https://jenkins.yourdomain.com. You should see the Jenkins initial setup password page:
Open your terminal and run the following command to retrieve the Jenkins setup password:
cat /var/lib/jenkins/secrets/initialAdminPassword
You should see the Jenkins password in the following output:
22c4dc0232454aef9a06cdd5c432b596
Now, paste the password from the above output and click on the Continue button. You should see the Plugins installation page:
Select Install suggested plugins or Select plugins to install. Once all the plugins are installed, you will be redirected to the Admin user creation page:
Provide your Jenkins admin user, password, email and click on the Save and Continue button. Once the installation has been finished, you should see the following screen:
Click on the Save and Finish button. You should see the following screen:
Now, click on the Start using Jenkins to open the Jenkins dashboard as shown below:
Conclusion
In the above guide, you learned how to install the Jenkins on CentOS 8. You also learned how to configure Nginx as a reverse proxy for Jenkins and enable Let’s Encrypt SSL support on Jenkins website. I hope this will helps you to install Jenkins to your server.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.