Learn how to install Jenkins on an Ubuntu EC2 instance step by step, configure Java, start the Jenkins service, open the required port, and access Jenkins from your browser.
Jenkins is one of the most widely used automation tools in the DevOps ecosystem.
It can help automate important software delivery tasks such as:
Build → Test → Package → Deploy
In this guide, we'll walk through how to install Jenkins on an Ubuntu EC2 instance on AWS and access the Jenkins dashboard for the first time.
What Is Jenkins?
Jenkins is an open-source automation server used to automate parts of the software development and delivery process.
A typical DevOps workflow can look like:
Developer
↓
GitHub
↓
Jenkins
↓
Build
↓
Test
↓
Docker
↓
Deploy
↓
Application
Instead of performing these tasks manually every time, Jenkins can automate them through jobs and pipelines.
Why Install Jenkins on AWS EC2?
AWS EC2 provides a virtual server where you can install and run Jenkins.
For someone learning DevOps, this is a useful hands-on setup because you get to work with:
AWS EC2
Ubuntu Linux
SSH
Java
Jenkins
Security Groups
Jenkins web interface
This gives you practical experience rather than only learning Jenkins through theory.
What You Need Before Installing Jenkins
Before starting, you should have:
- AWS Account
You need an AWS account to create an EC2 instance.
- Ubuntu EC2 Instance
Launch an Ubuntu-based EC2 instance.
- SSH Access
You should be able to connect to your EC2 instance using SSH.
For example:
ssh -i your-key.pem ubuntu@your-ec2-public-ip
- Required Network Access
Your EC2 Security Group needs to allow:
SSH → Port 22
Jenkins → Port 8080
Port 22 is used for SSH access, while Jenkins commonly uses port 8080 for its web interface unless you configure it differently.
Step 1: Launch an Ubuntu EC2 Instance
Go to:
AWS Console → EC2 → Launch Instance
Choose an Ubuntu Server image and configure the instance according to your learning requirements.
For a learning environment, you don't need a large production server.
Once the instance is running, note down its:
Public IPv4 address
You'll use it later to connect to Jenkins.
Step 2: Connect to the EC2 Instance
Use SSH to connect to your Ubuntu server.
Example:
ssh -i your-key.pem ubuntu@YOUR_PUBLIC_IP
Once connected, you'll see the Ubuntu terminal.
Now you're ready to install Jenkins.
Step 3: Update the Ubuntu Packages
Before installing anything, update the package information.
sudo apt update
You can also upgrade available packages when appropriate:
sudo apt upgrade
This ensures that your package information is up to date before continuing.
Step 4: Install Java
Jenkins runs on Java, so Java needs to be installed before Jenkins.
A commonly used option for Jenkins installations is OpenJDK.
For example:
sudo apt install openjdk-17-jdk -y
After installation, verify Java:
java -version
You should see the installed Java version in the terminal.
Why do we need Java?
Jenkins itself runs as a Java application, so Java is a prerequisite for running Jenkins.
Check The Video - HERE
Step 5: Add the Jenkins Repository
The next step is to configure the Jenkins package repository so Ubuntu can install Jenkins from the Jenkins project packages.
A typical installation involves importing the Jenkins signing key and configuring its package repository.
Then update the package information again:
sudo apt update
Step 6: Install Jenkins
Once the repository is configured, install Jenkins:
sudo apt install jenkins -y
Ubuntu will download and install Jenkins along with the required package files.
Step 7: Start Jenkins
After installation, start the Jenkins service:
sudo systemctl start jenkins
Now check whether Jenkins is running:
sudo systemctl status jenkins
You should see that the service is running.
For example:
Active: active (running)
Step 8: Enable Jenkins at Boot
You normally want Jenkins to start automatically whenever the EC2 instance restarts.
Use:
sudo systemctl enable jenkins
This ensures Jenkins starts automatically during system boot.
Step 9: Configure the AWS Security Group
This is a step many beginners miss.
Even if Jenkins is running correctly, you may not be able to access it from your browser if port 8080 is not allowed through the EC2 Security Group.
Go to:
AWS Console → EC2 → Security Groups → Inbound Rules
Add a rule for:
Type: Custom TCP
Port: 8080
For learning purposes, you may temporarily allow access from your IP address.
Avoid unnecessarily exposing administration ports to the entire internet in production environments.
Step 10: Open Jenkins in Your Browser
Once Jenkins is running and port 8080 is accessible, open:
http://YOUR_EC2_PUBLIC_IP:8080
For example:
http://18.123.45.67:8080
You should now see the Jenkins setup page.
Step 11: Get the Jenkins Initial Admin Password
During the initial setup, Jenkins asks for an administrator password.
You can retrieve it from the Jenkins server with:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the password and paste it into the Jenkins setup screen.
Step 12: Complete Jenkins Setup
Jenkins will then guide you through the initial setup.
You'll typically be given the option to install recommended plugins.
For a beginner, the recommended plugins are a good starting point.
Then create your Jenkins administrator account.
Once complete, you'll reach the:
Jenkins Dashboard
🎉 Your Jenkins installation is ready.
Jenkins Installation Flow
The entire process can be remembered like this:
AWS EC2
↓
Ubuntu
↓
SSH
↓
Install Java
↓
Add Jenkins Repository
↓
Install Jenkins
↓
Start Jenkins
↓
Open Port 8080
↓
Access Jenkins
↓
Get Initial Password
↓
Jenkins Dashboard
_How to Check Jenkins Status
_
Whenever you want to check whether Jenkins is running:
sudo systemctl status jenkins
To start Jenkins:
sudo systemctl start jenkins
To stop Jenkins:
sudo systemctl stop jenkins
To restart Jenkins:
sudo systemctl restart jenkins
To enable Jenkins at boot:
sudo systemctl enable jenkins
Common Problems When Installing Jenkins on EC2
- Jenkins page doesn't open
Check whether Jenkins is running:
sudo systemctl status jenkins
Then check your EC2 Security Group and make sure port 8080 is allowed.
- SSH connection doesn't work
Check:
EC2 instance is running
Correct public IP
Correct .pem key
Port 22 is allowed
Correct username is being used
For Ubuntu EC2 instances, the username is commonly:
ubuntu
- Jenkins service fails to start
Check the Jenkins service:
sudo systemctl status jenkins
Then inspect the logs:
sudo journalctl -u jenkins
You can use these logs to identify configuration or dependency problems.
- Java-related error
Check your Java installation:
java -version
Jenkins requires a supported Java runtime, so an incompatible or missing Java version can prevent Jenkins from starting.
What Should You Do After Installing Jenkins?
Installing Jenkins is only the beginning.
The next step is to create your first Jenkins job or Pipeline.
A good beginner project is:
GitHub
↓
Jenkins
↓
Build
↓
Test
↓
Docker
↓
AWS EC2
↓
Application
You can then gradually learn:
Jobs → Builds → Pipelines → Jenkinsfile → GitHub Webhooks → Docker → Deployment
This is where Jenkins becomes really useful.
Why Should DevOps Engineers Learn Jenkins?
Jenkins teaches you an important DevOps concept:
Automation of software delivery.
Instead of manually performing the same build, test and deployment steps repeatedly, you can turn those steps into an automated workflow.
That's why Jenkins is commonly associated with CI/CD.
Final Thoughts
Installing Jenkins on an Ubuntu EC2 instance may seem difficult the first time.
But once you understand the flow, it becomes straightforward:
EC2 → Ubuntu → Java → Jenkins → Port 8080 → Jenkins Dashboard
And the most important part isn't just getting Jenkins installed.
The real learning starts when you build your first pipeline, connect GitHub, introduce Docker, encounter a failed build, read the logs, troubleshoot it, and finally get:
BUILD SUCCESSFUL ✅
That's where DevOps starts becoming practical.
Learn one tool. Build one project. Break it. Fix it. Repeat. 🚀
Top comments (0)