How to install Rancher on Ubuntu 20.04?

Overview

Rancher is a framework for managing containers that aid in scaling Kubernetes administration. This software is particularly helpful because Kubernetes is typically included in standard infrastructure by cloud/virtualization suppliers.

You will discover how to setup Rancher on Ubuntu in this tutorial.

Prerequisites

There are certain prerequisites that need to be met before you begin.

  • Ubuntu 20.04 or any other Linux equipped system

  • A root user having Sudo privileges

  • Internet connection

Get Started

Step 1: Installing Docker

i. Always be sure to update your system before downloading the latest packages.

sudo apt update

ii. Run the following command to remove any previous Docker versions:

sudo apt remove docker docker-engine docker.io containerd runc

iii. Now, use the below command to install Docker:

sudo apt install docker.io​

iv. Check to see if the installation went well by executing the below command:

docker --version

v. Launch Docker services using the below command:

sudo systemctl start docker

vi. Configure Docker to execute at startup:

sudo systemctl enable docker

vii. Finally, verify Docker's status:

sudo systemctl status docker

The service should be shown in the output as active and/or running. By using Ctrl + C, you may close the status output.

Step 2: Installing Rancher

After installing Docker, you can use its platform to build a container on which you wish to execute the Rancher server.

i. Use the following command to create a fresh Rancher server container:

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

Docker will execute the container in detached mode and keep it running (unless explicitly terminated) in accordance with the command above. The server container is set up to listen on port 8080, but you may change it to suit your needs.

The container should be launched by Docker after retrieving the most recent Rancher image.

ii. Open any web browser and enter your server IP address and port in the URL box as follows to access the Rancher user interface:

https://[server_ip]:[port]

Conclusion

You should now be able to install Rancher on Ubuntu and set up the system to begin setting up Kubernetes clusters after reading this tutorial.

Last updated