BTCPay Server is an open-source, self-hosted payment processor that allows you to accept Bitcoin and other cryptocurrencies on your website or online store. In this tutorial, we will show you how to install BTCPay Server using Docker, a containerization platform that simplifies the process of deploying and managing applications.

Prerequisites

Before you begin, you will need the following:

  • A server or virtual private server (VPS) with Docker installed. If you don’t have one, you can use a cloud provider such as Amazon Web Services (AWS) or DigitalOcean.
  • A domain name that you can use for your BTCPay Server.
  • Basic knowledge of Docker and the command line.

Step 1: Pull the BTCPay Server Docker Image

The first step is to pull the BTCPay Server Docker image from the Docker Hub. Open a terminal window on your server and enter the following command:

docker pull btcpayserver/btcpayserver

This will download the BTCPay Server Docker image to your server.

Step 2: Create a Docker Network

Next, we need to create a Docker network that will allow the BTCPay Server container to communicate with other containers. To do this, enter the following command:

docker network create btcpay

This will create a new Docker network called “btcpay”.

Step 3: Create a MySQL Container

BTCPay Server requires a MySQL database to store its data. We can use Docker to easily create a MySQL container for this purpose. To do this, enter the following command:

Copy codedocker run -d --name mysql --net btcpay -e MYSQL_ROOT_PASSWORD=<your_mysql_root_password> mysql:5.7
Replace <your_mysql_root_password> with a strong password of your choice. This command will create a new MySQL container with the name "mysql" and attach it to the "btcpay" network.

Step 4: Create the BTCPay Server Container

Now we can create the BTCPay Server container. To do this, enter the following command:

Copy codedocker run -d --name btcpay --net btcpay -e BTCPAY_HOST=<your_domain> -e BTCPAY_MYSQL_SERVER=mysql -e BTCPAY_MYSQL_ROOT_PASSWORD=<your_mysql_root_password> -p 80:80 -p 443:443 btcpayserver/btcpayserver

Replace <your_domain> with your domain name and <your_mysql_root_password> with the password, you set in the previous step. This command will create a new BTCPay Server container with the name “btcpay” and attach it to the “btcpay” network. It will also bind the container’s ports 80 and 443 to the host’s ports 80 and 443, allowing you to access BTCPay Server from the web.

Step 5: Set Up BTCPay Server

Once the BTCPay Server container is running, you can access the setup wizard by going to your domain in a web browser. Follow the prompts to set up your BTCPay Server instance.