Last active
February 19, 2025 15:28
-
-
Save hivivo/20eb5355837533c968ecb9e684f85007 to your computer and use it in GitHub Desktop.
Install CapRover on a brand new Ubuntu 22.04 standard server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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`" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.