How To Setup Rancher On Centos 7

In this tutorial , We will learn how to install and configure Rancher on Centos 7.

Lets us see how to install Rancher and setup Local authentication.

What Is Rancher?

  • Rancher is an open source container management platform.
  • Rancher provides infrastructure services such as multi-host networking, load balancing, and volume snapshots.
  • It allows you to run and manage Docker and Kubernetes containers with ease.
  • Rancher allows you to build and launch Kubernetes compute nodes directly from the Rancher web interface.


  • Linux host with 64-bit Centos 7 OS.
  • Minimum 4 GM of RAM.
  • Install supported version of Docker.

Install Docker On Centos 7

Docker must be installed on the server to run rancher.

Docker engine can be installed in different ways.

a)Setup Docker repository on the system and install using it.

b)Download the RPM package and installing packages manually.

Make sure you have sudo or root privileges to execute the following commands.

First we need to install yum-config-manager utility ,

sudo yum install yum-utils -y

Lets add the Docker repository to the system, Using the below command.

sudo yum-config-manager --add-repo

Lets go ahead and install the latest version of Docker engine and containerd packages ,

sudo yum install docker-ce docker-ce-cli

After the packages are installed , We can start the Docker service.

The above installation will create a systemd unit file using which we can manage the Docker service.

cat /usr/lib/systemd/system/docker.service

Start and Enable the Docker service using the below commands.

systemctl start docker
systemctl enable docker

To check the status of the docker , Run the below command.

systemctl status docker

We can check the version of docker engine installed.

sudo docker --version

If you wish to install the specific version of docker engine from the repository.First list the available versions in the repo and then we will install the specific version of docker.

yum list docker-ce --showduplicates | sort -r

To install the specific version , Use the version string from the second column.

For example : 17.12.1.ce-1.el7.centos

Lets install the above mentioned version using the below command.

sudo yum install docker-ce-17.12.1.ce-1.el7.centos

If you are installing custom version of docker and If the docker is already present on the system , The above commands with either Upgrade or Downgrade the docker version depending on the currently installed version of Docker.

Once installation is completed, Check the docker service and enable it to run on system boot.

Installing Rancher

As we have the docker installed in the system ,We can install Rancher as a docker container on the Centos server.

sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server

The above command will download the latest version of rancher docker image to the Centos host machine.

Run the below command to list the available docker images in the system.

sudo docker images

To check the running rancher container , Run the below command.

sudo docker ps

from the above screenshot , You can see that the rancher is listening on the port 8080.

You can access the Rancher portal using IP address or domain name followed by port 8080.


You will be greeted with the following screen.


What happened here is , We have accessed the Rancher portal without username and password , as the authentication is not configured yet.

Rancher supports various access control methods such as Active Directory , Azure AB , Local , GitHub , OpenLDAP and Shibboleth.

To setup an Authentication for Rancher access portal ,Under Admin click Access control


You should see the following page.


Click LOCAL , Provide the username and password to setup Admin user.


and then click Enable Local Auth.


If you can now login using username and password , which we configured as a Admin user.

You will see the following screen , While accessing http://ipaddress:8080


Provide the username and password and then you will be taken into rancher dashboard.


We have implemented Rancher on the Centos 7 and also we have enabled Local authentication mechanism for the Portal.

Hope you find it helpful.

Please do check out my other publications.