Installing Jenkins on Ubuntu
Your CI/CD journey starts here
Need to set up Jenkins for your CI/CD pipeline? Let's get it installed on Ubuntu. Jenkins is that automation tool you've probably heard about - it builds your code, runs tests, and deploys stuff automatically. Pretty handy.
We're installing it from the official Jenkins repository to make sure we get the latest stable version.
What You Need
- Ubuntu 20.04 or later
- Sudo privileges
- About 5 minutes
The Installation
Step 1: Update Your System
Start fresh:
sudo apt update -y
Step 2: Install Java
Jenkins runs on Java, so we need that first. We'll also grab fontconfig which Jenkins uses for some features:
sudo apt install fontconfig openjdk-17-jre -y
This installs Java 17, which is what Jenkins needs to run.
Step 3: Add Jenkins Repository Key
Download the Jenkins signing key so your system can verify the packages:
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
Step 4: Add Jenkins Repository
Tell your system where to find Jenkins packages:
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
This adds the Jenkins repository to your sources list.
Step 5: Update Package List
Refresh to include the Jenkins repository:
sudo apt-get update -y
Step 6: Install Jenkins
Now install Jenkins:
sudo apt-get install jenkins -y
Jenkins will install and start automatically as a service.
Check If It's Running
Let's verify Jenkins is up:
sudo systemctl status jenkins
You should see "active (running)" in green. That means Jenkins is running.
Access Jenkins
Jenkins runs on port 8080 by default. Open your browser and go to:
http://your-server-ip:8080
You'll see a setup screen asking for an initial admin password. Get it with:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy that password, paste it in the browser, and follow the setup wizard. Pick "Install suggested plugins" unless you know exactly what you need.
Security note: If you're running this on a server exposed to the internet, make sure to set up a firewall or use a reverse proxy. Don't leave port 8080 wide open.
All Commands Together
Here's the complete installation in one block:
sudo apt update -y
sudo apt install fontconfig openjdk-17-jre -y
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-get update -y
sudo apt-get install jenkins -y
What's Next?
Now that Jenkins is running, you can create pipelines, connect to GitHub, set up automated builds, and all that good CI/CD stuff. The Jenkins docs have plenty of tutorials to get you started.
That's it. Jenkins is installed and ready to automate your workflow. Happy building! 🚀
Comments
Post a Comment