Steps for installing Caprover

I would recommend Ubuntu as the distro of choice because most docker images function best with it. Official recomendation is for Ubuntu 18.04 but for me 20.04 has worked fine.
Step 0 : SSH into the machine (VM or bare-metal and follow these instructions)

Code to Upgrade packages:

sudo apt-get update && sudo apt-get upgrade -y

Steps to Install Docker

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \ 
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli
To verify if Docker is working:
sudo docker run hello-world
Configure Firewall
Clear all already set iptables if set by your cloud provider and configure firewall via UFW (personal preference)
Also make sure to allow ports which you are actively using for caprover from your router or cloud provider's console.
sudo ufw allow 22,80,443,3000,996,7946,4789,2377/tcp; sudo ufw allow 7946,4789,2377/udp;
Installing Caprover
Just run the following line, sit back and enjoy!
sudo docker run -p 80:80 -p 443:443 -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock -v /captain:/captain caprover/caprover
NOTE: Do not change the port mappings. CapRover only works on the specified ports.
Configure domain name (after port forwarding if hosting in your home)
  • should point to publicly reachable IP address of the machine
Assuming you have npm installed on your local machine (e.g., your laptop), simply run (add sudo if needed):
npm install -g caprover
Then, run
caprover serversetup
and follow the instructions shown.