Install Jenkins on Ubuntu22
Jenkins is a CI/CD tool.
It's an open-source automation server used to automate the repetitive tasks involved in the CI/CD of software.
Jenkins is Java based.
To install Jenkins, always follow the latest updates from the official site.
https://www.jenkins.io/doc/book/installing/linux/#debianubuntu
Install Java
To run Jenkins, java is required.
Update your apt package index
sudo apt update
Check if Java is already installed:
java -version
If not installed then install the JRE from OpenJDK11
sudo apt install openjdk-11-jre
Install Jenkins
curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins
Start Jenkins
Enable Jenkins service to start at boot with the command:
sudo systemctl enable jenkins
start the Jenkins service with the command:
sudo systemctl start jenkins
check the status of the Jenkins service using the command:
sudo systemctl status jenkins
The package installation will:
Run
systemctl cat jenkins
for more details.Create a ‘jenkins’ user to run this service.
Direct console log output to
systemd-journald
. Runjournalctl -u jenkins.service
if you are troubleshooting Jenkins.Populate
/lib/systemd/system/jenkins.service
with configuration parameters for the launch, e.gJENKINS_HOME
Set Jenkins to listen on port 8080. Access this port with your browser to start the configuration.
If Jenkins fails to start because a port is in use, run systemctl edit jenkins
and add the following:
[Service]
Environment="JENKINS_PORT=8081"
Here, "8081" was chosen but you can put another port available.
Post-installation setup wizard
Create an administrator user through which you can continue accessing Jenkins.
Browse to http://<ip-address>:8080
(or whichever port you configured for Jenkins when installing it) and wait until the Unlock Jenkins page appears.
Follow the instructions and set up the first Jenkins user.
Once you complete the setup, Jenkins welcome page will appear.
You installed Jenkins successfully :)