You are on page 1of 3

How to Install Jenkins on EC2 centos/redhat

1. Jenkins works on java (can be installed on either Linux or windows OS)


2. You will need to install java first, below the steps to install Jenkins on the Linux machine
Check the note “How to install Java on Linux”
3. To check whether the java is installed or not
$ java -version
4. You will need a root user, or a user with sudo access.

Add Jenkins to the centos repository

The below command will reach out to Jenkins server and download the repository:
(wget -O download the content from the internet to a file)
sudo wget -O /etc/yum.repos.d/jenkins.repo \

https://pkg.jenkins.io/redhat-stable/jenkins.repo

Otherwise, you can add Jenkins repo manually


sudo nano /etc/yum.repos.d/jenkins.repo

And add the following lines and save file.


[jenkins]

name=Jenkins-stable

baseurl=http://pkg.jenkins.io/redhat

gpgcheck=1

Import the Jenkins key to make sure that the software is legitimate

sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key


sudo yum upgrade

Install Jenkins

sudo yum install jenkins java-1.8.0-openjdk-devel -y


sudo systemctl daemon-reload

Start and Enable Jenkins

systemctl start jenkins

systemctl status jenkins

systemctl enable Jenkins


Starting Jenkins GUI

The default URL for jenkins is

http://dns-name-or-ip:8080

In case of using and EC2, we will need to allow port 8080 on the inbound security group rules

Now you will be able to access Jenkins GUI and you can get the initial Admin user password

[root@ip-172-31-28-24 jenkins]# cat /var/lib/jenkins/secrets/initialAdminPassword

d684e9e812e64be4b444eabd25f1fe79

change your password to Admin/admin

You might also like