Jenkins is the most widely used open-source automation server. It supports building, testing, and deploying software through pipelines defined as code (Jenkinsfile). This guide installs Jenkins LTS on Ubuntu 26.04 LTS and secures it behind Nginx with HTTPS.
Tested and valid on:
- Ubuntu 26.04 LTS
Prerequisites
- Ubuntu 26.04 LTS with Java 21+ (OpenJDK)
- Nginx installed
- Ports 80 and 443 open in UFW
Step 1 – Install Java
sudo apt update
sudo apt install openjdk-21-jdk -y
java -version
Step 2 – Add the Jenkins Repository
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
sudo apt update
Step 3 – Install Jenkins LTS
sudo apt install jenkins -y
sudo systemctl start jenkins
sudo systemctl enable jenkins
sudo systemctl status jenkins
Step 4 – Retrieve the Initial Admin Password
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Step 5 – Configure Nginx Reverse Proxy
sudo nano /etc/nginx/sites-available/jenkins
Add:
server {
listen 80;
server_name jenkins.example.com;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
sudo ln -s /etc/nginx/sites-available/jenkins /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
Step 6 – Add SSL
sudo certbot --nginx -d jenkins.example.com
Step 7 – Complete Setup via Browser
Visit https://jenkins.example.com. Enter the initial admin password, install suggested plugins, and create the first admin user.
Conclusion
Jenkins is installed and secured on Ubuntu 26.04 LTS. Create your first pipeline by adding a Jenkinsfile to your repository and configuring a Jenkins job to pull from it.