How To Setup Jenkins On Ubuntu Server
Hey there, this guide is a comprehensive tutorial on how to setup jenkins on an ubuntu server. I am asuming that you know what jenkins is and what it is used for? If you don't, it is an automation server that lets you build pipelines to automate testing, building, and deploying your app. Okay what did you say?.. how..? let's see.
Prerequisites
1. A linux server. ( you can do it on your ubuntu system as well )
2. Access credentials ( username and password )
3. Active & average speed internet of course.
I am using Ubuntu 22.04.5 LTS, but the process is similar on most ubuntu server. You can also proceed with an ubuntu server on you local machine. ( technically that is also a server ). I'll be using linux terminal for commands ( it should work on powershell as well ).
Let's start by connecting to our server.
$ ssh [email protected] $ The authenticity of host '23.292.232.43 (23.292.232.43)' can't be established. ED25519 key fingerprint is SHA256:/ YHhSJfjy6UqI2wFzm+mPbNPjnaE1n86dsBCMf2dsdsg. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/ [fingerprint])? yes $ Warning: Permanently added '23.292.232.43' (ED25519) to the list of known hosts. [email protected]'s password:
Type yes to add the new host information in your system. Then provide the password of the server.
NOTE: The password will not be visible because of security concerns just type and hit enter to continue
Now you must be logged in to the server. Now first update the server and install updates if available. $ sudo apt update && sudo apt upgrade -y
Install Java
Java is a required dependency of jenkins this is the language behind jenkins. By the time of writing jenkins is using openjdk-17-jre. Head over to this page to see current supported version.
$ sudo apt install fontconfig openjdk-17-jre
Install Jenkins
Once java is installed, we can proceed with the jenkins installation. Refer to jenkins' installation page to see the detailed release info. First obtain keyrings:
$ sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \ https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key $ echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]" \ https://pkg.jenkins.io/debian-stable binary/ | sudo tee \ /etc/apt/sources.list.d/jenkins.list > /dev/null
Then update the package list and install the jenkins lts
$ sudo apt update && sudo apt-get install jenkins
This will install jenkins on your server. You can verify this by checking the status of jenkins service.
$ sudo systemctl status jenkins
It should output something like followings:
ā jenkins.service - Jenkins Continuous Integration Server Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2025-01-15 17:53:17 UTC; 28s ago Main PID: 10596 (java) Tasks: 55 (limit: 9250) Memory: 1.0G CPU: 1min 14.822s
Conclusion
Congratulations!! we have successfully installed the jenkins server on our machine. We will configure the jenkins server once we are done with setting up nginx. Stay tuned for next step. I'll provide the link of that article here. Thank you.