In this tutorial, we will show you how to install Rancher on your CentOS 7. For those of you who didn’t know, The rancher is an open-source program that helps you to run the containers in production. The rancher is based on Docker, which means it’s possible to run it on a dedicated box, KVM machine, or perhaps on an LXC container. Rancher provides a huge library of applications that are installed in a few clicks and also supports docker pictures from Dockerhub.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Rancher private container service on a CentOS 7 server.
- A server running one of the following operating systems: CentOS 7.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Rancher on CentOS 7
Step 1. First, let’s start by ensuring your system is up-to-date.
yum clean all yum -y install epel-release yum -y update
Step 2. Installing Docker.
Before we install the Rancher server, we have to install the docker-machine. If you do not have a docker installed, you can follow our guide here.
Step 3. Installing Rancher.
On the Linux machine with Docker installed, the command to start a single instance of Rancher is simple:
docker run -d --restart=unless-stopped -p 8080:8080 rancher/server:stable
Step 4. Configure Firewall for Rancher.
The rancher server uses port 8080 for the web interface. Configure the firewall to allow port 8080 and reload it:
firewall-cmd --zone=public --add-port=8080/tcp --permanent firewall-cmd --reload
Step 5. Accessing Rancher.
Rancher will be available on HTTP port 8080 by default. Open your favorite browser and navigate to
http://server-ip-addrss:8080 and complete the required steps to finish the installation.
*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.
Congratulations! You have successfully installed Rancher. Thanks for using this tutorial for installing Rancher private container service on CentOS 7 systems. For additional help or useful information, we recommend you to check the official Rancher website.