Install Jenkins on Ubuntu and AWS in under 10 minutes

Yatharth Chauhan
3 min readDec 8, 2023

Easy setup guide to install Jenkins on Ubuntu and AWS.
LinkedIn: Click Here

www.yatharthchauhan.me

Step-1 Install Java

Update your system

sudo apt update

Install java

sudo apt install openjdk-21-jre

Validate Installation

java -version

It should look something like this after running the command

openjdk version "21.0.1" 2023-10-17

Step-2 Install Jenkins

The commands you provided are used to add the Jenkins repository and its GPG key to your system, specifically for Debian-based Linux distributions.

  1. Add Jenkins GPG Key:
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
  • wget: This command is used to retrieve content from the specified URL.
  • -q: This option stands for "quiet," which means that wget will not produce any output except for errors.
  • -O -: This option specifies where to write the downloaded content. In this case, it writes to the standard output (-).
  • https://pkg.jenkins.io/debian/jenkins-ci.org.key: This is the URL of the Jenkins GPG key.

2. Add Jenkins Repository to APT Sources:

echo "deb http://pkg.jenkins.io/debian-stable binary/" | sudo tee -a /etc/apt/sources.list.d/jenkins.list
  • echo "deb http://pkg.jenkins.io/debian-stable binary/": This echoes the repository information to the console.
  • | sudo tee -a /etc/apt/sources.list.d/jenkins.list: The tee command is used to write the echoed content to a file. Here, it appends (-a option) the content of the /etc/apt/sources.list.d/jenkins.list file. This file is typically used to store additional APT repositories.

3. Setting up your system to install Jenkins.

sudo apt-get update
sudo apt-get install jenkins

Step-3 Start Jenkins

Enable Jenkins (to start on boot):

sudo systemctl enable jenkins

Start Jenkins (immediately):

sudo systemctl start jenkins

Check Jenkins Service Status:

sudo systemctl status jenkins

To start Jenkins:

sudo service jenkins start

Open your web browser and enter the following URL in the address bar:

http://localhost:8080

To stop Jenkins:

sudo service jenkins stop

To restart Jenkins:

sudo service jenkins restart

Step-4 Setup Jenkins

  1. Set an Admin Password to use Jenkins: Copy the command below and paste it on a terminal and you will get your Admin Password.
/var/lib/jenkins/secrets/intialAdminPassword

2. Install suggested plugins

Customize Jenkins

2. Create a Username and Password

Create First Admin User

3. Keep it running on the default URL

Instance Configuration

4. Start using Jenkins

Jenkins is ready!

Follow the same process as mentioned above to install Jenkins on Ubuntu to Install in AWS EC2.

1. Launch EC2 Instance:
- Create an EC2 instance on AWS using an Ubuntu AMI.
- Configure security groups to allow inbound traffic on ports 22 (SSH) and 8080 (Jenkins).

2. Connect to EC2 Instance:
Use SSH to connect to your EC2 instance:

ssh -i your-key-pair.pem ubuntu@your-ec2-instance-ip

3. Install Java

4. Install Jenkins

5. Start Jenkins

6. Access Jenkins Web Interface

http://your-ec2-instance-ip:8080

7. Setup Jenkins

8. Start Using Jenkins

Note: Remember to adjust the security group settings in AWS to ensure the ports are open for SSH and Jenkins.

Share it as much as you can and Follow for more blog content for you all, Thank you for your support❤️

To know more about me check my portfolio: https://yatharthchauhan.me

Connect with me:
LinkedIn: Click Here
GitHub: Click Here
Instagram: Click Here
Fiverr: Click Here
Medium: Click Here

--

--

Yatharth Chauhan

Learn Together and Grow Together | Ex-Intern @Microsoft | Final Year Student at CHARUSAT University