Learn How To Install Rancher on Ubuntu 14.04

October 30, 2019

Table of Contents

If you are using a different system, please check our other tutorials.

Introduction

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 a LXC container. Rancher provides a huge library of applications which are installed within a few clicks and also supports docker images from Dockerhub.

Requirements

  • At least 1GB Memory
  • A Linux distribution that supports Docker ( in our case we’ll be using Ubuntu )

Installing

As already stated above, Rancher is based on Docker. That requires us to have the latest version of Docker installed on our machine. In order to install the latest Docker version, we have to run the following command:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" > /etc/apt/sources.list.d/docker.list
sudo apt-get update && sudo apt-get install docker-engine apparmor
sudo docker run -d --restart=always -p 8080:8080 rancher/server

After waiting some minutes for Rancher to complete some initial processes and setup, we can visit the Rancher Admin Interface at http://SERVER_IP:8080.

Configuration

Because we don’t want that everybody has access to our Rancher Admin Interface, we restrict the access to our personal user ( which we have to create first ). We navigate to the page Admin->Accounts and create our user there. After creating the user, Rancher should turn on authentication by default. If it does not, you can navigate to Admin->Access Control and enable it there.

After we’ve finished these steps, we can already start deploying our first containers and using Rancher!

Adding another host

When scaling applications, it’s very important to have multiple physical servers running as container backends. Rancher has a very easy system to add more hosts with just one command.

All other hosts must fulfil the same requirements are our master node. After we install Docker on them, we have to navigate to Infrastructure->Hosts and click the “Add Hosts” button. Once we’ve entered our details ( like server IP ) and customized it to fit our needs, we can copy the command which Rancher generated for us and run it on the server which we want to use as second ( or third, there’s actually no limit ).

After doing this step, it takes a few minutes for the second server to setup and install all the dependencies. The host will automatically pop-up under the Infrastructure->Hosts page once the tasks mentioned one sentence earlier are done.

Conclusion

Rancher is great for scaling and deploying Docker containers at any size. And more interestingly, Rancher is provided as open source. Open source means that you can edit the source to fit your needs or even participate in development.

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!