DEV Community

Joshua O.
Joshua O.

Posted on

How To Set Up Jenkins on Linux

Jenkins provides CI/CD functionality, making sysadmin and developer lives easier. See how to install and set up this useful service on an AWS Linux VM instance.

1. Spin Up An AWS Instance

On your EC2 Dashboard, spin up a new t2.medium instance with a RedHat Linux 8/9 HVM at 4GB of RAM space. Create a Security Group and Open the required ports, 8080 for Jenkins. Once the instance is set up, SSH into the instance from your IDE and proceed to download dependencies.

2. Download Dependencies

CD into the /opt directory; which is reserved for the installation of third party software

cd /opt
Enter fullscreen mode Exit fullscreen mode

install java, git, tree, unzip and wget

sudo yum -y install unzip wget tree git
Enter fullscreen mode Exit fullscreen mode

install java cookie

sudo wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm
Enter fullscreen mode Exit fullscreen mode
sudo yum install jdk-8u131-linux-x64.rpm -y
Enter fullscreen mode Exit fullscreen mode

3. Add Jenkins Repository and Key

Import Jenkins Repository for RedHat

sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
Enter fullscreen mode Exit fullscreen mode

CD to /etc/yum.repos.d/

sudo cd /etc/yum.repos.d/
Enter fullscreen mode Exit fullscreen mode

Save file link in the above directory

sudo curl -O https://pkg.jenkins.io/redhat-stable/jenkins.repo

Enter fullscreen mode Exit fullscreen mode

4. Install Jenkins

sudo yum -y install jenkins --nobest
Enter fullscreen mode Exit fullscreen mode

Start the Jenkins Service

sudo systemctl start jenkins
Enter fullscreen mode Exit fullscreen mode

Enable Jenkins Service

sudo systemctl enabl jenkins
Enter fullscreen mode Exit fullscreen mode

5. Check Jenkins Status

sudo systemctl status jenkins
Enter fullscreen mode Exit fullscreen mode

Now you should have your Jenkins successfully
installed!!

NB: To access Jenkins on your browser, enter your instance Public IP address followed by a colon and port number like this (XXX.XXX.XXX:8080).

Here's how to install Jenkins in other ways (Installing Jenkins)

Top comments (0)