How to Install Caprover on Ubuntu Server 22.04

Caprover is an open-source platform that simplifies the deployment and management of applications. It allows you to deploy web apps and databases quickly and efficiently. In this tutorial, we'll guide you through the process of installing Caprover on an Ubuntu 22.04 server using EcoStack Cloud.

ubuntu docker install caprover
Medium
VPS
2
vCPU
8 GB
Memory
80 GB
NVMe Disk
4096 GB
Traffic
20.90
/month
* Up to 4 vCPU, 24GB RAM, 240GB NVMe Disk Space and 1Gbit/s Network Speed
--- ### Prerequisites Before you begin, ensure you have: 1. An active VPS from EcoStack Cloud running Ubuntu 22.04. 2. A domain name pointed to your VPS's IP address (optional but recommended for HTTPS). ### Step 1: Update Your Server First, ensure your server is up-to-date: ```sh sudo apt update -y sudo apt upgrade -y ``` ### Step 2: Install Docker Caprover runs on Docker, so you need to install Docker on your server: ```sh sudo apt install apt-transport-https ca-certificates curl software-properties-common -y curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.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 -y ``` Add your user to the Docker group to avoid using `sudo` with Docker commands: ```sh sudo usermod -aG docker $USER newgrp docker ``` ### Step 3: Install Caprover Run the following command to install Caprover: ```sh docker run -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 caprover/caprover ``` You will see a bunch of outputs on your screen. Once Caprover is initialized, you can visit `http://[IP_OF_YOUR_SERVER]:3000` in your browser and log in to Caprover using the default password `captain42`. You can change your password later. However, do not make any changes in the dashboard yet. ### Step 4: Connect Root Domain To set up a root domain: 1. Let's say you own `mydomain.com`. Set `*.something.mydomain.com` as an A-record in your DNS settings to point to the IP address of the server where you installed Caprover. 2. It may take several hours for the DNS changes to take effect. You can verify the DNS setup by checking if `randomthing123.something.mydomain.com` resolves to your server's IP. Here’s how your DNS configuration should look: - **TYPE:** A record - **HOST:** *.something - **POINTS TO:** (IP Address of your server) - **TTL:** (any value) ### Step 5: Install Caprover CLI Install the Caprover CLI tool on your local machine (make sure you have `npm` installed): ```sh npm install -g caprover ``` Then, run: ```sh caprover serversetup ``` Follow the steps and log in to your Caprover instance. When prompted for the root domain, enter `something.mydomain.com`. ### Step 6: Deploy the Test App 1. Go to the Caprover dashboard in your browser. 2. From the left menu, select **Apps** and create a new app. Name it `my-first-app`. 3. Create a simple test app or use an existing one, and navigate to its directory on your local machine. 4. Deploy the app using the CLI: ```sh caprover deploy ``` Follow the instructions and enter `my-first-app` when asked for the app name. The first build takes about two minutes. After the build is completed, visit `my-first-app.something.mydomain.com` to see your app live. ### Step 7: (Optional) Set Up Swap File If you encounter issues due to insufficient RAM, you can set up a swap file as virtual RAM. This can help avoid memory-related issues during Docker image builds. ## Conclusion Congratulations! You have successfully installed Caprover on your Ubuntu 22.04 server using EcoStack Cloud. With Caprover, you can now deploy and manage your applications effortlessly. If you haven't tried EcoStack Cloud yet, sign up today and get your VPS ready in just one minute. Happy deploying! ---


Created with ❤ at Estonia
EcoStack Technology OÜ