UbuntuUbuntu Based

How To Install Rancher on Ubuntu 22.04 LTS

Install Rancher on Ubuntu 22.04

In this tutorial, we will show you how to install Rancher on Ubuntu 22.04 LTS. For those of you who didn’t know, Rancher is a popular open-source container management platform used to deploy and manage Kubernetes clusters, Docker containers, and other containerization technologies. It provides a centralized user interface for managing containerized applications, scaling resources, and monitoring their performance

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 open-source container management platform on Ubuntu 22.04. You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
  • 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).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Rancher and Docker.
  • A non-root sudo user or 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 Ubuntu 22.04 LTS Jammy Jellyfish

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade

Step 2. Installing Docker.

By default, Docker is not available on Ubuntu 22.04 base repository. Now run the following command below to add the Docker repository to the system:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list

Next, import the GPG key to your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

After the repository is enabled, now install the latest version of the Docker package using the below command:

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin

You can verify that Docker is installed and about the current version:

docker version

You should see the following output:

Client:
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.17.3
 Git commit:        20.10.12-0ubuntu4
 Built:             Mon Mar  7 17:16:06 2023
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.3
  Git commit:       20.10.12-0ubuntu4
  Built:            Mon Mar  7 15:34:50 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.5.9-0ubuntu3
  GitCommit:        
 runc:
  Version:          1.1.0-0ubuntu1
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:

After successfully installed, enable Docker (to start automatically upon system boot), start, and verify the status using the commands below:

sudo systemctl enable docker
sudo systemctl start docker
sudo systemctl status docker

By default, Docker requires root privileges. If you want to avoid using sudo every time you run the docker command, add your username to the docker group:

sudo usermod -aG docker $(whoami)
su - ${USER}

Confirm that your user is added to the Docker group:

groups

For additional resources on installing and managing Docker, read the post below:

Step 3. Installing Rancher on Ubuntu 22.04.

Now that Docker is installed, we can proceed with the installation of the Rancher Server on Ubuntu 22.04. To install the Rancher Server, you can follow the steps outlined below:

sudo docker pull rancher/rancher:latest

Next, run the Rancher Server container:

sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:latest

Step 4. Configure Firewall.

Now we set up an Uncomplicated Firewall (UFW) with Rancher to allow public access on default web ports 80 and 443:

sudo ufw allow OpenSSH
sudo ufw allow http
sudo ufw allow https
sudo ufw enable

Step 5. Accessing Rancher Web Interface.

Now open your web browser and access the Rancher Web UI using the URL https://your-domain.com. You will be redirected to the following page:

Install Rancher on Ubuntu 22.04 LTS Jammy Jellyfish

The Rancher login screen should appear, prompting you to set up a new admin password. Once you have set up your admin password, you can start managing and deploying containerized applications using Rancher’s intuitive web interface.

Congratulations! You have successfully installed Rancher. Thanks for using this tutorial for installing Rancher container management on the Ubuntu system. For additional help or useful information, we recommend you check the official Rancher website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button