VM setup

Setting up a cloud VM

Requirements

  • A linux server with a public IP address.

I am using a Ubuntu 22.04 server with 1GB RAM and 1vCPU on Oracle Cloud.

Update the system

  • Boot the VM & ssh into it.
  • Update the system: sudo apt update && sudo apt upgrade -y

Install docker

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

sudo apt update
sudo apt install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

sudo mkdir -p /etc/apt/keyrings
 curl -fsSL <https://download.docker.com/linux/ubuntu/gpg> | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

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

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

Add current user to docker group

  • If you are not logged in as root, you will need to add your user to the docker group to run docker commands without sudo.
sudo usermod -aG docker $USER

Open ports for http & https

  • This is Oracle Cloud specific as I am using it.
  • Go to the VM’s home page.
  • Find “Subnet” under “Primary VNIC” section and click on it
  • Navigate to “Security Lists” > “Default Security List for VCN” > Add Ingress Rules button
  • Source CIDR: 0.0.0.0/0, IP Protocol: TCP, Destination Port Range: 80, 443
  • Click on “Add Ingress Rules” button
  • This will open ports 80 & 443 to the internet