How to install Jenkins on Amazon EC2 Instance (Ubuntu - 18.04)?

Installing Jenkins on an Amazon EC2 Instance (Ubuntu 18.04)

Jenkins is a popular open-source automation server that helps developers automate parts of the software development process. In this guide, we will show you how to install Jenkins on an Amazon EC2 instance running Ubuntu 18.04.

Before you start, make sure you have an Amazon Web Services (AWS) account and an EC2 instance running Ubuntu 18.04.

Step 1: Update the System

To begin, log in to your EC2 instance and update the system to ensure all the packages are up to date:

sudo apt-get update

sudo apt-get upgrade

Step 2: Install Java

Jenkins requires Java to be installed on the system. To install Java, run the following commands:

sudo apt-get install openjdk-8-jdk

Step 3: Add the Jenkins Repository

Add the Jenkins repository to your system's list of software sources:

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -

sudo sh -c 'echo deb https://pkg.jenkins.io/debian binary/ > /etc/apt/sources.list.d/jenkins.list'

Step 4: Install Jenkins

Now that the Jenkins repository has been added to the system, run the following command to install Jenkins:

sudo apt-get update

sudo apt-get install jenkins

Step 5: Start Jenkins

Once the installation is complete, start the Jenkins service:

sudo systemctl start jenkins

Step 6: Enable Jenkins to Start on Boot

To ensure Jenkins starts automatically when the EC2 instance is rebooted, run the following command:

sudo systemctl enable jenkins

Step 7: Access Jenkins

To access Jenkins, open a web browser and navigate to http://<public_ip>:8080. Replace <public_ip> with the public IP address of your EC2 instance. You will be prompted to enter the initial password, which can be found in the following file:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Copy the password from the file and paste it into the prompt on the web page. From there, follow the instructions to complete the setup process.

Congratulations, you have successfully installed Jenkins on your Amazon EC2 instance running Ubuntu 18.04. You are now ready to start using Jenkins for your automation needs.

Comments

Post a Comment

Comments are always welcome, that will help us to motivate ourselves and improve our services. Thanks!!

Popular posts from this blog

How to update build number in Azure DevOps pipeline?

How to get latest build ID from Azure DevOps pipeline?

How to install AWS System Manager (SSM) Agent on windows using PowerShell?