Installing Jenkins Server & Slave on Linux Platforms

Jenkins AWS AMIs by Kurian for building robust CI/CD pipeline.

Complete Jenkins offerings by Kurian in AWS marketplace, that can be tried out for free.

When it comes to install an application on Linux distributions they look very different. You have to deal with multiple package management systems and installation steps that might not look much in common unfortunately. Here we would see how Jenkins software is installed on two representative Linux platforms, Ubuntu and CentOS.

Following steps work on all the latest versions of Ubuntu — 16.06, 18.04 and 20.04

$ wget -q -O - | sudo apt-key add -$ sudo sh -c 'echo deb binary/ > /etc/apt/sources.list.d/jenkins.list'$ sudo apt-get update -y$ sudo apt-get install jenkins -y

The following steps work on both CentOS 7 and 8 with slight variations.

$ sudo wget -O /etc/yum.repos.d/jenkins.repo$ sudo rpm --import Edit /etc/yum.repos.d/jenkins.repo and set 'gpgcheck=0'# On CentOS 7
$ sudo yum install jenkins -y
# On CentOS 8
$ sudo dnf install jenkins -y
# On CentOS firewall might be needed to make port 8080 open
# use following steps if needed.
$ sudo service firewalld start
$ sudo firewall-cmd --zone=public --add-port=8080/tcp
$ sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent

Luckily the steps involved in setting a Jenkins slave host is generic on Linux platforms.

  • Create OS group “jenkins”.
  • Create OS user “jenkins” with: group “jenkins”, home directory “/var/jenkins” and shell “/bin/bash”.
  • Create “/var/jenkins/.ssh”
$ sudo mkdir /var/jenkins/.ssh
$ sudo chown jenkins:jenkins /var/jenkins/.ssh
$ sudo chmod 700 /var/jenkins/.ssh
  • Setup password-less sudo-as access for jenkins user
$ sudo echo "jenkins ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jenkins-user

That’s pretty much you need to do on the slave host prior to adding it as a slave on a Jenkins server. Those configuration steps follow.

If you are on Amazon AWS, Kurian provides Jenkins Server and Slave AMIs on all popular Linux distributions. All you need is to spin up required nodes and start using them immediately with very little configuration. The full list of AMIs currently available on AWS Marketplace is provided below for you to try out for free.

There are multiple ways to add a slave node to Jenkins server:

  • Launch agent on slave node via SSH
  • Launch agent on slave by connecting it to the server
  • Automatically provisioned build nodes using Amazon EC2 plugin

All these 3 configuration methods are documented at

Feel free to file a bug or a note about the information provided here if you run into issues.

We provide building blocks and directions to kick start or fine tune your DevOps practice.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store