
This article provides a guide demonstrating how to deploy CapRover on Ubuntu VPS.
What is CapRover?
CapRover is a free, open-source Platform-as-a-Service (PaaS) that lets you deploy web applications, databases, and Docker containers with a simple web interface. It provides a Heroku-like experience on your own VPS while automatically handling SSL certificates, reverse proxy configuration, Docker orchestration, and application deployments.
This guide walks through deploying CapRover on a fresh Ubuntu VPS.
Prerequisites
Before you begin, make sure you have:
- Ubuntu 22.04 or Ubuntu 24.04 VPS
- Minimum 1 GB RAM (2 GB recommended)
- Root or sudo access
- A domain name
- Access to your DNS provider
- Ports 80, 443, and 3000 open on the server firewall
How to Deploy CapRover on Ubuntu VPS
To deploy CapRover on Ubuntu VPS, follow the steps below:
-
Connect to Your VPS
SSH into your server:
ssh root@YOUR_SERVER_IP
Or if using a sudo user:
ssh username@YOUR_SERVER_IP
Update the system:
apt update && apt upgrade -y
Reboot if required:
reboot
Reconnect via SSH afterward.
-
Install Docker
CapRover runs entirely on Docker and requires Docker Engine 25.x or newer. Avoid installing Docker through Snap packages, as CapRover recommends the official Docker installation method.
Install Docker dependencies:
apt install -y \ apt-transport-https \ ca-certificates \ curl \ gnupg \ lsb-release \ ufw \ nodejs \ npm
Add Dockerβs GPG key:
mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg \ | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
Add Docker repository:
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
Install Docker:
apt update apt install -y \ docker-ce \ docker-ce-cli \ containerd.io \ docker-buildx-plugin \ docker-compose-plugin
Enable Docker:
systemctl enable docker systemctl start docker
Verify installation:
docker --version
Example output:
Docker version 27.x.x
-
Configure the Firewall
Allow the required CapRover ports:
ufw allow 22/tcp ufw allow 80/tcp ufw allow 443/tcp ufw allow 3000/tcp
Enable the firewall:
ufw enable
Verify:
ufw status
If you plan to use Docker Swarm clusters later, also open:
ufw allow 2377/tcp ufw allow 7946/tcp ufw allow 7946/udp ufw allow 4789/udp
-
Install CapRover
Create the CapRover data directory:
mkdir -p /captain
Run the CapRover container:
docker run -d \ --restart=always \ -p 80:80 \ -p 443:443 \ -p 3000:3000 \ -e ACCEPTED_TERMS=true \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /captain:/captain \ --name captain \ caprover/caprover
Check that it is running:
docker ps
You should see a container named:
captain
Run the following commands to setup CapRover:
npm install -g caprover caprover serversetup
-
Access the CapRover Dashboard
Open your browser and visit:
http://YOUR_SERVER_IP:3000
Log in using the default password:
captain42
Immediately change the password after logging in.
-
Configure DNS
CapRover requires a wildcard DNS record because every deployed application receives its own subdomain.
Example:
If your domain is:
example.com
Create:
Type Host Value A caprover VPS_IP A *.caprover VPS_IP This allows:
captain.caprover.example.com app1.caprover.example.com app2.caprover.example.com
Wait for DNS propagation.
Verify:
dig random.caprover.example.com +short
It should return your VPS IP.
-
Configure CapRover Root Domain
Inside the dashboard:
- Open CapRover Settings
- Select Root Domain
- Enter:
caprover.example.com
- Click Save & Update
CapRover will validate your DNS settings.
-
Enable HTTPS
Once the root domain resolves correctly:
- Go to Settings
- Select Enable HTTPS
- Click Enable HTTPS
CapRover automatically requests and installs Letβs Encrypt SSL certificates.
After completion, your dashboard becomes:
https://captain.caprover.example.com
Caprover dashboard -
Install the CapRover CLI (Optional)
On your local machine:
npm install -g caprover
Verify:
caprover --version
Login:
caprover login
Provide:
Server URL Password Machine Name
The CLI enables deployments directly from your terminal.
-
Deploy Your First Application
Create a simple Node.js application.
Generate a deployment configuration:
caprover deploy
Or create a
captain-definitionfile:{ "schemaVersion": 2, "dockerfilePath": "./Dockerfile" }Deploy:
caprover deploy
CapRover will:
- Build the image
- Create Docker services
- Configure Nginx
- Issue SSL certificates
- Make the app publicly accessible
Installing One-Click Applications
CapRover includes a marketplace for common software.
Popular one-click deployments include:
- WordPress
- PostgreSQL
- MySQL
- MariaDB
- MongoDB
- Redis
- Grafana
- Nextcloud
- Ghost
- Portainer
Install from:
Apps β One-Click Apps/Databases
Useful Maintenance Commands
View logs:
docker logs captain
Restart CapRover:
docker restart captain
Check container status:
docker ps
Check disk usage:
df -h
Update CapRover:
docker pull caprover/caprover docker restart captain
Troubleshooting
Dashboard Not Loading
Check:
docker ps
And:
docker logs captain
Verify port 3000 is open:
ss -tulpn | grep 3000
SSL Certificate Fails
Verify DNS:
dig captain.caprover.example.com
Ensure:
- Port 80 is reachable
- Port 443 is reachable
- DNS points directly to the VPS
- Cloudflare proxy mode is disabled during setup
Conclusion
You now know how to deploy CapRover on Ubuntu VPS and have a fully functional CapRover installation running on Ubuntu. With Docker, automatic SSL certificates, wildcard subdomains, one-click applications, and Git-based deployments, CapRover provides an excellent self-hosted alternative to Heroku, Render, or Railway while keeping full control of your infrastructure.










