Easy Guide to Set Up Jenkins on Ubuntu AWS EC2 Instance

Easy Guide to Set Up Jenkins on Ubuntu AWS EC2 Instance

Jenkins is an extensible automation server widely used in the software development lifecycle. It supports continuous integration and delivery by automating the processes of building, testing, and deploying applications through a robust plugin system.

Jenkins can run on various operating systems, including windows, macOS and Linux.

Continuous Integration: Automatically building and testing code changes to ensure they integrate smoothly.

Continuous Delivery: Automating the deployment of applications to various environments, including development, testing, and production.

How Jenkins works

image 5

                In this guide, you will learn how to install Jenkins on ubuntu in AWS ec2 instance. Ready to roll? let’s do this!

STEP1: Create the instance.

In the AWS management console, Find the EC2 service and then click on launch instance.

image 9

You create the name and choose on Amazon Machine Image (AMI) is ubuntu.

image 10

Then you will be directed to this page, this is where the service will be running on, select the t2.micro which contains the Free tier eligible tag.

image 11

Create a new key pair (or use an existing one if you already have one), enter a name, and click download key pair. Then click Launch Instance and wait for the instance to go to running state.

image 12
image 13

STEP2: Installing Jenkins

You select the instance and click the connect option, and then next you click the connect.

image 14

You should see the following page.

image 15

And then next, you will update the instance.

sudo apt update
image 16
image 17

Java needs to be installed and configured on the server on which you want to configure Jenkins. OpenJDK is preferred with Jenkins, but you can also use any other version of Java.

Enter the comment below.

sudo apt install openjdk-8-jdk -y
image 18
image 19

To install Jenkins on to your operating system, follow the latest documentation provided by Jenkins. (Use this link https://pkg.jenkins.io select the Debian-stable you’ll get the URL for Jenkins package).

Now, you enter the comment step-by-step.

sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
    https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
image 20
image 21

Add a Jenkins apt repository entry,

  sudo apt-get update
  sudo apt-get install fontconfig openjdk-17-jre
  sudo apt-get install Jenkins
image 22
image 23
image 24
image 25
image 26
image 27

To check if the java version is installed, use the command.

image 28

Using the systemctl start command start the Jenkin service, and then use the systemctl enable command .

Sudo systemctl start Jenkins
Sudo systemctl enable Jenkins
Sudo systemctl status jenkins
image 29

Once you reached the end, you will see the Jenkins running page.

image 30

STEP3: Setting up Jenkins.

To set up your installation, visit Jenkins on its default port, 8080 ,   using your instance IP address.

image 31

You see the following page, now you will go to the terminal, enter the sudo cat command to display the password.

image 32
image 33

Copy the 32-character alphanumeric password from the terminal and paste it into the Administrator password field, then click Continue.

Screenshot 2024 10 02 134954

Next you click the install suggested plugins.

image 35
image 36

Create an admin user. Make sure you remember the username and password.

image 37

Click save and finish.

image 38

Next, click start using Jenkins.

image 39

You visit the main Jenkins dashboard.

image 40

CONCLUSION

                        Finally you install the Jenkins on ubuntu machine. Jenkins is free to use and has a large community of contributors who continuously improve the software. However, to maximize its benefits, teams should prioritize proper configuration, maintain a clean and organized Jenkins environment, and invest in training to ensure effective usage. As the software landscape evolves, Jenkins continues to adapt, remaining a key player in DevOps practices and agile methodologies.

Tags: No tags

Add a Comment

Your email address will not be published. Required fields are marked *