Skip to content

Instantly share code, notes, and snippets.

@hivivo
Last active February 8, 2024 18:52
Show Gist options
  • Save hivivo/20eb5355837533c968ecb9e684f85007 to your computer and use it in GitHub Desktop.
Save hivivo/20eb5355837533c968ecb9e684f85007 to your computer and use it in GitHub Desktop.
Install CapRover on a brand new Ubuntu 22.04 standard server
#!/bin/bash
# Ubuntu 22.04
# Please also allow `80, 443, 3000` ports in the VM network rules if apply
# run as sudo
if [ "$EUID" -ne 0 ]
then echo "Please run as root or use sudo"
exit
fi
# prepare installing docker
apt-get update
apt-get install -y ca-certificates curl gnupg lsb-release
mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | 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" | tee /etc/apt/sources.list.d/docker.list > /dev/null
# install docker engine
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
# update built-in firewall
ufw allow 80,443,3000,996,7946,4789,2377/tcp
ufw allow 7946,4789,2377/udp
# install CapRover
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
echo 'Please run "caprover serversetup" on your laptop to finish setup'
echo "IP: `hostname -I`"
@oelegeirnaert
Copy link

Hi,

I used a Ubuntu Minimal Server, and UFW is not installed by default, so this script is failing.
Maybe you need to add UFW on line 14 as well?
Just a suggestion :-)

Kr,
Oele

@oelegeirnaert
Copy link

Another thing i had to do, is making root owner of the /

chown root:root /

@oelegeirnaert
Copy link

On my Ubuntu Server 22.04 minimal i also had to add the -e argument togeter with the var: MAIN_NODE_IP_ADDRESS > but this is typical when you run it locally

install CapRover

docker run -e MAIN_NODE_IP_ADDRESS=127.0.0.1 -p 80:80 -p 443:443 -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock -v /captain:/captain caprover/caprover

@hivivo
Copy link
Author

hivivo commented Nov 6, 2022

This gist is working for the standard setup. I guess for the minimal server setup or other customized setup, the steps could be slightly different accordingly. Your suggestions may work for you but not for other customizations, so I will only provide a tested standard way for the default setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment