How to set up Code Ready Containers on Ubuntu.

suyog shinde
nonstopio
Published in
4 min readApr 25, 2022

--

Let’s make the installation blog interesting, Why do I install code-ready containers on my ubuntu machine.

It’s a short story or a situation.

I was preparing for my Redhat Openshift certification (DO180) and didn't have labs to practice and learn. Buying an OpenShift cluster was not an option for me. A platform called Minishift didn't give me that functionality to practice, for example using operators.

So after searching a lot I got introduced to CodeReadyContainers.

What is a CodeReadyContainer ??

In simple words, it’s an OpenShift Cluster on your Linux machine

CodeReady Containers is the quickest way to get started building OpenShift clusters. It is designed to run on a local computer to simplify setup and testing and emulate the cloud development environment locally with all of the tools needed to develop container-based applications.

Let’s start with setting up the cluster.

  1. You need to have an account at https://cloud.redhat.com/
  2. If you don't have an account you need to create it.

Hardware requirements

  • 4 physical CPU cores
  • 9 GB of free memory
  • 35 GB of storage space
  • Ubuntu 18.04 LTS or later and Debian 10 or later are not supported and may require manual set up of the host machine.

Required software packages for Linux

sudo apt install qemu-kvm libvirt-daemon libvirt-daemon-system network-manager

3. Keep this link open in a new tab https://console.redhat.com/openshift/create/local

4. On the above link, you can see the download option called

“Download CodeReadyContainer”

5. Let’s Extract the contents of the archive.

$ tar xvf crc-linux-amd64.tar.xz

6. Let’s Create the ~/bin directory if it does not exist and copy the crc executable to it.

$ mkdir -p ~/bin
$ cp ~/Downloads/crc-linux-*-amd64/crc ~/bin

7. Now, Add the ~/bin directory to your $PATH:

$ export PATH=$PATH:$HOME/bin
$ echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc

8. Now, the next step is to copy the secret and store it in a file so you will need it while setting up the OpenShift Cluster.

Note: You can see the pull secret above in the image, similarly you'll see it on your console.

9. Now run the below command to start the CRC setup.

$ crc setup

Note: After running this command there will be lots of things going but at one step you’ll be asked to paste the pull secret. So paste the pull secret which we stored above step no 8.

10. After the CRC setup is done successfully, you can start the cluster using.

$ crc start

You will see an output like this

11. To use the oc command

$ eval $(crc oc-env)$ oc login -u developer https://api.crc.testing:6443

12. To get the console credentials.

$ crc console --credentialsTo login as a regular user, run 'oc login -u developer -p developer https://api.crc.testing:6443'.
To login as an admin, run 'oc login -u kubeadmin -p yQ8tf-Kkvea-nUHd6-Km8hR https://api.crc.testing:6443'

13. You can log in through the console now.

End of the story.
I passed my exam with a Good Score.

Thank you for reading this article/story.

Do read my other blogs on various topics related to DevOps

  1. Setup GitLab runner on AWS-ec2

2. Part 1: GitHub Actions → Docker Hub — Versioning → Continous Integrations

--

--