How to install Rancher on CentOS 7

Estimated reading: 3 minutes 330 views


Rancher is an open-source platform for running containers and building a private container service. Rancher is based on Docker, so you can run it on a dedicated box, KVM machine, or even on an LXC container. Rancher provides a huge library of applications that are installed within a few clicks and also supports docker images from Dockerhub.


  • An instance with CentOS 7 x64.
  • At least 1GB memory.
  • supported version of Docker.

Install Docker

As stated, Docker is required to run Rancher, so we will install it first.
First, remove any old Docker files, if necessary.

sudo yum remove docker docker-common docker-selinux docker-engine

NoteYou may get a report that no Docker files are installed. This is safe to ignore.
Install required packages.

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

Add a stable repo.

sudo yum-config-manager --add-repo

Check the available versions of Docker CE.

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

You will see an output similar to the following text.

You can install the latest version of Docker CE simply using the sudo yum install docker-ce command, but in a production environment, it is recommended that you install a specific version rather than the latest version.
To specify the version of Docker CE to install, append the version-string, (second column), of the latest stable version to the package name followed by a “-“, as shown in the following command.

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

Start Docker.

sudo systemctl start docker

Verify that Docker is installed correctly.

sudo docker run hello-world

This command runs a test image in a test container to print a message, then exits. The message will be similar to the following output.

Install Rancher

Now we’re are ready to install Rancher.

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

Wait a few minutes to allow the Rancher UI to boot. Then, open your favorite browser and go to port 8080 on your server.


Be sure to replace 192.x.x.x it with your actual server’s IP address.
Rancher doesn’t configure access control by default, so it is important to set this up immediately, otherwise, the UI and API can be accessed by anyone who has your IP.
Hover over the ADMIN tab, and click Access Control.
Follow the instructions in the Rancher UI to set up whichever form of access control you prefer.
That’s all! Enjoy GreenCloudVPS services!

Leave a Comment