How to Install CapRover on a VPS or Dedicated Server

10 min read
Install CapRover

Suppose you are an application developer, of course. In that case, you are no stranger to hearing the term PaaS (Platform as Services), where you can develop applications without having to bother with server infrastructure. Take, for example, Heroku or AWS Elastic Beanstalk from AWS; they are well-known senior PaaS service providers.

Before further discussing CapRover, let's first deepen our understanding of PaaS.

What is PaaS (Platform As Services)?

PaaS (Platform as a Service) is a cloud computing service that provides a platform for building, running, and managing web applications without manually managing server infrastructure. PaaS provides tools, technologies, and services to build and manage web applications, including databases, operating systems, middleware, and more.

By using PaaS, web developers can focus on building applications without the hassle of managing server infrastructure. PaaS also makes it easy to deploy applications to production by providing features such as continuous integration and delivery, scaling, and monitoring.

Some examples of popular PaaS services are Heroku, AWS Elastic Beanstalk, Google Cloud Platform, Microsoft Azure, and now even Digital Ocean provides PaaS.

The service has server and network infrastructure managed by each PaaS provider. Therefore, even though their prices are relatively lower, they still feel expensive if our applications are growing and require more extensive resources.

Well, of course, we will think, what if we have our own PaaS in our server infrastructure, so we only have to pay for the server? The solution is CapRover!

What is CapRover?

CapRover is a platform that allows you to easily manage web and server applications on VPS (Virtual Private Server), dedicated servers, and cloud hosting such as Digital Ocean, Amazon AWS, Google Cloud, and others.

CapRover provides an intuitive web interface that allows users to set up and manage web applications, including installing, starting, stopping, and removing applications. CapRover also provides features such as a load balancer, reverse proxy, auto SSL, and integration with Git, making it easier for you to manage web applications more quickly and efficiently.

CapRover is the perfect platform for web developers or users who want to easily manage web applications on cloud hosting without manually managing server infrastructure. CapRover can install on various cloud hosting such as DigitalOcean, Linode, AWS EC2, and Google Cloud.

In other words, CapRover is a free and self-managed PaaS because it is open-source. There are modern applications ready to be installed easily with just one click.

Domain settings have also been provided, which are integrated with automatic SSL. So you no longer need to remember when renewing your SSL Certificate because everything is automated.

Interesting right?

Some examples of applications available on CapRover are as follows;

Databases

  • MongoDB
  • MongoExpress
  • MsSQL
  • MySQL
  • Redis
  • PhpMyAdmin
  • PostgreSQL
  • Adminer
  • Apache CouchDB
  • Gitea
  • ElasticSearch
  • And many more.

Blog and Connet

  • WordPress
  • Ghost
  • Prisma 1
  • Strapi
  • Minio
  • And more.

Dev Tools

  • Jenkins
  • Drone.io
  • Hasura
  • Nexus3
  • And more

Aplikasi Lainnya

  • Parse
  • NextCloud
  • Rainloop
  • Thumbor
  • OhMyForm

And actually, there are many more; if your CapRover is installed, you will see all the applications we are ready to install with just one click.

Why should CapRover?

Here are some of the advantages that you can find on CapRover, a PaaS (Platform as a Service) service that allows you to manage web applications and servers on a VPS (Virtual Private Server), Dedicated Server, or cloud hosting:

  1. Intuitive interface
    CapRover provides an easy-to-use web interface that allows you to manage web applications quickly and easily.
  2. Complete deployment features
    CapRover provides features such as continuous integration, delivery, and rollback, making it easier for you to manage web applications on the production stage more efficiently.
  3. Scalability
    CapRover provides a scaling feature that makes it easy to adjust the number of application instances according to your needs.
  4. Monitoring and logging
    CapRover provides a monitoring feature that makes it easier to find application performance and identify possible problems. CapRover also provides a logging feature that makes it easier to analyze application activity.
  5. Active documentation and community
    CapRover has extensive documentation and an active community that can help you manage your web applications more efficiently.

Installing CapRover on a VPS or Dedicated Server is like having our own PaaS, so we don't have to worry about cost overruns caused by excess server resources.

Install Cap Rover

CapRover installation is relatively easy because DigitalOcean has prepared One Click Install on the Digital Ocean marketplace. You must choose your server specifications and continue the installation; CapRover is ready to use.

However, we will try to install CapRover step by step so that we understand better, and if one day a problem occurs, we will easily find a solution.

This article will use a VPS from Digital Ocean with 1GB RAM and Ubuntu 20.04 Operating System.

Precondition

Before proceeding, here are some things needed to install CapRover.

  1. VPS or Dedicated Server: Minimum 1GB RAM with Ubuntu 18 and above operating system. In this article, we use Ubuntu 20.04
  2. Domain name: You must have a domain name. First, it doesn't matter if the domain is already in use because we will only use the subdomain set on the DNS server. This article will use the teknotut.com domain with the app.teknotut.com subdomain.
  3. DNS Server: If you have purchased a domain, a DNS server is usually provided; you can use the provider's default DNS server or another provider, such as Cloudflare. In this article, we will use DNS from Cloudflare.

Installation Process

If all the prerequisites above have been met, please access your server using SSH and follow the CapRover installation process below.

Step #1: Firewall Configuration

Usually, using Ubuntu fresh install will block some ports that are generally not used. Please type the command below to open the required port on CapRover;

ufw allow 80,443,3000,996,7946,4789,2377/tcp; ufw allow 7946,4789,2377/udp;

Step #2: Swap Configuration

Because in this article we are using 1GB of RAM, we will set up a swap of 2GB (recommended swap amount is 1.5x or 2x the amount of RAM). Type the command below to configure a Swap Memory of 2GB.

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
sudo sysctl vm.swappiness=10
馃挕
To understand the concept of swap memory and configuration on Linux, please follow our article entitled Understanding Swap Memory in Linux and How to Configure it.

Step #3: Install Docker

On the CapRover platform using Docker, you need Docker on your Ubuntu. To install Docker, please type the following command;

apt update
apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
sudo apt -y install docker-ce
sudo systemctl start docker
sudo systemctl enable docker
馃挕
To understand more about Docker containers, please follow our article, What is Docker Container?

Step #4: Install the Docker CapRover Image

Next, we will install CapRover on Docker from the latest CapRover main image. Type the following command to 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

To see other versions of CapRover, you can visit the Docker Hub page.

Next, wait until the installation process is complete. When finished, the display on your terminal screen will look something like this;

December 29th 2022, 9:03:16.088 am    Fresh installation!
December 29th 2022, 9:03:16.090 am    Starting swarm at 157.230.47.xx:2377
Swarm started: tfas8le4csrgu84b7h8femevr
*** CapRover is initializing ***
Please wait at least 60 seconds before trying to access CapRover.

Wait about 1 minute before going to the following process (Step #6).

Step #5: Install CapRover CLI (Optional)

The CapRover CLI (Command Line Interface) is required for initial setup in the main CapRover domain and SSL settings. However, this step is optional, so you don't need to do this step because domain and SSL settings can be done directly on the main CapRover interface. However, if you are comfortable using the command line, you can continue at this stage.

CapRover CLI is written using Node.js, so please first install Node.js on your system. To install Node.js, please follow our article on How to Install Node.js. After successfully installing Node.js, please type the following command to install CapRover CLI;

npm install -g caprover

Then use the command below to start the domain and SSL configuration and follow the prompts;

caprover serversetup

Step #6: Domain and SSL Configuration

Go to your domain's DNS server to configure a subdomain to your server's IP address. In the DNS configuration in this example, we will configure *.app.teknotut.com to point to the IP server. The * sign in the subdomain is a DNS wildcard, which means that any text before .app.teknotut.com will be redirected to the destination server IP.

This article uses Cloudflare as the domain's DNS server, so the settings are below.

DNS Wildcard Setting in Cloudflare
DNS Wildcard Setting in Cloudflare

When finished, ensure the DNS is running perfectly by pinging the host app.teknotut.com; if it responds with the IP server, it means the domain is leading correctly. If you haven't waited a while, maybe your DNS settings are in DNS propagation.

Now, open your browser and go to the page http://<Server IP>:3000; for example, in this case, our server is 157.230.47.xx, then we will go to http://157.230.47.xx:3000. You will enter the main CapRover login page and the default CapRover password, captain42.

Login page CapRover
Login page CapRover

After logging in, you will immediately enter the CapRover dashboard, and the subdomain configured earlier in the CapRover root domain, as shown below.

Root domain Configuration
Root domain Configuration

Click on the Update Domain button, and the page will automatically redirect to captain.app.teknotut.com, and you will be asked to log in again. After logging back in, click on Enable HTTPS, and enter your email address (for Let's Encrypt accessible SSL data); after success, click on the Force HTTPS button so that every time you access CapRover, you will be redirected to HTTPS.

Step #7: Change Default Password (Important)

When you activate Force HTTPS, you will be redirected to the HTTPS page and have to log in again. Login again with the default password, then enter the Settings menu.

Enter your default password in the Old password and your new password in New Password.

Hooray, until your CapRover installation process is complete, we will try to install one of the applications on this new CapRover.

Test Install Application (WordPress)

OK, now let's try to install one of the ready-to-use applications; in this case, we will try to install WordPress 6.0.1. When this article was written, the latest WordPress version was version 6.0.3, but we will try to install version 6.0.1. Later we will upgrade to 6.0.3, and we will simulate a rollback to version 6.0.1 again, so we can understand how to upgrade and roll back if the upgrade is unsatisfactory.

On your CapRover dashboard, click on the Apps menu, then click on One-Click Apps/Databases.

Install the new app CapRover
Install the new app CapRover

The next page will cover all applications installed on CapRover; type WordPress in the search field, then select WordPress.

Install WordPress in CapRover
Install WordPress in CapRover

Next, an installation configuration will appear, such as the application name, MySQL password, and the database version used; in this article, we will install WordPress version 6.0.1.

Config WordPress Installation
Config WordPress Installation

After the configuration is filled, click on the Deploy button!

CapRover will complete WordPress installation processes such as WordPress core, Nginx, PHP, and MySQL in one click.

Install WordPress Finish
Install WordPress Finish

Installing WordPress is complete; then, we will configure the WordPress we have installed.

When you click the Finish button, you will return to the Apps menu, where you can see that there are two installed applications, namely WordPress and its database. Then, click on the wordpress-wordpress Application.

CapRover app List
CapRover app List

Click on the Enable HTTPS button to activate the free SSL Certificate. If you already have a domain for your new WordPress, enter the domain name in the domain form, click the Connect New Domain button, and click Enable HTTPS again. Select the Force HTTPS by redirecting all HTTP traffic to the HTTPS option, all traffic is redirected to HTTPS. Then click Save & Update.

App Configuration CapRover
App Configuration CapRover

Next, we will configure WordPress at the URL https://wordpress-wordpress.app.teknotut.com or you're domain name if you have entered a domain name in your new WordPress. This article only uses wildcard domains and does not use the main domain. Follow the installation steps according to the wizard instructions on your WordPress page.

Done; you can log in to your WordPress WP Admin now. When you log in to the WP Admin, it turns out that the WordPress version is immediately upgraded to version 6.1.1; you can upgrade WordPress directly from your WP Admin.

Install NetData Engine (Optional)

CapRover is equipped with a server monitoring system, but only simple monitoring. If you want to install a monitoring system with beautiful GUI (Graphical User Interfaces) and complete data, you can install NetData Engine on your CapRover. The installation method is straightforward, click on the Monitoring menu, then click the Start NetData Engine button.

Install NetData Engine on CapRover
Install NetData Engine on CapRover

Please wait for the installation process to finish; when it's finished, an Open NetData button will appear, click on the button, and you will be redirected to /net-data-monitor/.

So, your server monitoring system is now complete, as shown in the image below.

NetData CapRover Display
NetData CapRover Display

Nice!

Conclusion

Based on this article, it can be concluded that How Install CapRover on a VPS or Dedicated Server is a relatively straightforward process because it only requires a few simple steps to complete the installation, such as preparing the server, downloading CapRover, configuring and activating it.

After that, you will be ready to manage your applications with CapRover and enjoy its benefits.

In this article, we have also tried to install an application, namely WordPress; the installation process is straightforward, fast, and easy to understand. In the following article, we will try to install and explain other applications that can make our daily work easier. Keep monitoring the Teknotut website!

I hope this article helps.