Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install BTCPayServer in Linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Today, I will talk to you about how to install BTCPayServer in Linux. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

Install dependencies

To run BTCPayServer, you need to install .NET Core SDK,NBXplorer and PostgreSQL.

Install .NET Core SDK

Go to the download folder or any other folder used to store temporary files:

Cd ~ / Downloads

And download the Microsoft package required for the .NET Core SDK:

Wget-qO- https://packages.microsoft.com/keys/microsoft.asc | gpg-- dearmor > microsoft.asc.gpgsudo mv microsoft.asc.gpg / etc/apt/trusted.gpg.d/wget-Q https://packages.microsoft.com/config/ubuntu/$(lsb_release-sr) / prod.listsudo mv prod.list / etc/apt/sources.list.d/microsoft-prod.list

Update the package cache and install the .NET Core:

Sudo apt-get install apt-transport-httpssudo apt-get updatesudo apt-get install dotnet-sdk-2.1 install NBXplorer

We need to install NBXplorer to track incoming chain transactions.

If you haven't created the source folder and opened it:

Mkdir ~ / sourcecd ~ / source

Clone the repository and build the code:

Git clone https://github.com/dgarage/NBXplorercd NBXplorer./build.sh

Create a data folder:

Mkdir-p ~ / .nbxplorer/Maincd ~ / .nbxplorer/Main

New profile:

Touch settings.config

Open the file using the editor of your choice and add the following lines:

Btc.rpc.auth=:port=24445mainnet=1

Be sure to use your bitcoind's rpc login credentials. You can find them using the following command:

Cat ~ / .bitcoin/bitcoin.conf | grep rpc

Test that all settings are correct:

/ usr/bin/dotnet ~ / source/NBXplorer/NBXplorer/bin/Release/netcoreapp2.1/NBXplorer.dll-c ~ / .nbxplorer/Main/settings.config

If so, type ctrl + c to terminate the process and download the Systemd service:

Cd / usr/lib/systemd/systemsudo wget https://gist.githubusercontent.com/mariodian/de873b969e70eca4d0a7673efd697d0a/raw/acfc70c5694cd53d8a3df7ff54a35ff2caba7532/nbxplorer.service

Edit the file according to your environment.

Enable the service, start it, and check the status:

Sudo systemctl enable nbxplorer.servicesudo service nbxplorer startsudo service nbxplorer status

If you do not see the error, please go to the next step.

Install PostgreSQL

I couldn't set up BTCPayServer using MySQL/MariaDB, so I was forced to use PostgreSQL.

First install it and open the shell prompt as the newly created system user:

Sudo apt install postgresql postgresql-contribsudo-I-u postgres

Create a new database user:

Createuser-pwprompt-interactive

Enter the following (you can change satoshi to any user name you like):

Create a new database:

Createdb-O satoshi btcpayserver

If you see no error in exiting shell:

Exit install BTCPayServer

Clone the repository and build the code:

Cd ~ / sourcegit clone https://github.com/btcpayserver/btcpayserver.gitcd btcpayserver./build.sh

Create a data folder:

Mkdir-p ~ / .btcpayserver/Maincd ~ / .btcpayserver/Main

A new configuration file:

Touch settings.config

Take the certificate fingerprint of LND and paste it into the configuration file below.

Openssl x509-noout-fingerprint-sha256-inform pem-in ~ / .lnd/tls.cert

Open settings.config and add the following line:

Network=mainnetport=23001bind=0.0.0.0chains=btcBTC.explorer.url= http://127.0.0.1:24445BTC.lightning=type=lnd-rest;server=https://127.0.0.1:8080/;macaroonfilepath=~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon;certthumbprint=postgres=User ID=;Password=;Host=localhost;Port=5432;Database=btcpayserver

Change the highlighted variable variables according to your settings.

Check to see if everything is normal.

/ usr/bin/dotnet run-p ~ i/source/btcpayserver/BTCPayServer/BTCPayServer.csproj-c ~ / .btcpayserver/Main/settings.config-- network=mainnet

If so, type ctrl + c to terminate the process and download the Systemd service:

Cd / usr/lib/systemd/systemsudo wget https://gist.githubusercontent.com/mariodian/07bb13da314e2a321784b380f543651a/raw/6cef554d9e8311e683a017d5e63a07822dee7642/btcpayserver.service

Edit the file according to your environment.

Enable the service, start it, and check that it is functioning properly:

Sudo systemctl enable btcpayserver.servicesudo service btcpayserver startsudo service btcpayserver status

Congratulations, you just got through the hardest part!

Allow incoming connections (optional)

If you want to run the server remotely, you must open port 23001.

First, go to the router settings and find the part of the virtual server Virtual Server or port forwarding Port Forwarding, and set port forwarding on the above port.

Then go back to your linux machine and open the port with iptables:

Sudo iptables-An INPUT-p tcp-- dport 23001-j ACCEPT

If you use iptables-save, also run the following command:

Sudo iptables-save > / etc/iptables/rules.v4

You should now be able to connect to your server from another computer.

Set up BTCPayServer

Go to your BTCPayServer management, sign up for a new administrator account and log in.

Now, go to Stores and click Create a new store. When you are finished, go to the store settings and scroll down to Derivation Scheme.

Click modify Edit under BTC, and then open the wallet that supports BIP32 on your computer or mobile phone.

For the purposes of this tutorial, I will use Electrum.

It is recommended that you create a new wallet instead of using an old one, so you don't have to bother to rescan the balance on the address.

When you are finished, click Wallet-> Information, copy the master public key, paste it back into BTCPayServer management, select enabled, and save.

Next, scroll down to Lightning nodes (Experimental), and then click modify modify.

You should set your connection string, but if not, please paste the following:

Type=lnd-rest;server= https://127.0.0.1:8080/;macaroonfilepath=/home/satoshi/.lnd/data/chain/bitcoin/mainnet/admin.macaroon;certthumbprint=

Please remember to add the fingerprint of your previous LND certificate and change the home directory to your own directory.

Click Test connection Test connection, and if everything is fine, select Enable enabled and click submit submit.

In this case, the server runs on a separate computer that you want to access through the domain name, go to Server Settings-> Maintenance, and add your name to Change domain name (of course, you must buy it).

You must also add CNAME or A DNS records to your domain name provider according to your settings. I'm sorry, I can't help you. There are too many providers.

You should now be able to access BTCPayServer management using the new domain name, as follows: http://domain.ltd:23001.

To create a POS terminal, go to Apps-> Create a new app and fill out a short form. Then you will enter the application settings, and you can change the project list through the template.

You can also add a simple payment button to the site, which you can configure in Stores-> Settings-> Pay Button or manually create invoices in Stores-> Invoices-> Create a new invoice. Then you can send it to the customer.

Of course, the front-end design of the payment gateway is completely customizable, so you can set your own logo and color.

Set SSL encryption certificate (optional)

First, let's install Apache 2, which will be used as a reverse proxy.

Sudo apt-get install apache2

Enable the required modules:

Sudo a2enmod rewritesudo a2enmod proxysudo a2enmod proxy_httpsudo a2enmod proxy_ajpsudo a2enmod deflatesudo a2enmod headerssudo a2enmod proxy_balancersudo a2enmod proxy_connectsudo a2enmod proxy_html

Restart the server:

Sudo systemctl restart apache2

Install the Let's encryption certificate for your domain name. But you can use any other certification authority.

Replace the contents of / etc/apache2/sites-enabled/000-default.conf with the following:

ServerAdmin webmaster@localhost ServerName btcpay.freedomnode.com RewriteEngine on RewriteCond% {SERVER_NAME} = btcpay.freedomnode.com RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] ErrorLog ${APACHE_LOG_DIR} / error.log CustomLog ${APACHE_LOG_DIR} / access.log combined

Change the ServerName according to your needs.

Then, replace the contents of / etc/apache2/sites-enabled/000-default-le-ssl.conf with the following:

ServerAdmin webmaster@localhost ServerName btcpay.freedomnode.com ErrorLog ${APACHE_LOG_DIR} / error.log CustomLog ${APACHE_LOG_DIR} / access.log combined ProxyPass "/" http://127.0.0.1:23001/" ProxyPassReverse / "http://127.0.0.1:23001/" ProxyPreserveHost On SSLCertificateFile / etc/letsencrypt/live/btcpay.freedomnode.com/fullchain.pem SSLCertificateKeyFile / etc/letsencrypt/live/btcpay.freedomnode.com/privkey.pem Include / etc/letsencrypt/options-ssl-apache.conf

Third, edit the ServerName and make sure that SSLCertificateFile and SSLCertificateKeyFile point to the correct file.

Reload the server:

Sudo systemctl reload apache2

Now go back to ~ / .btcpayserver / Main/settings.config and add:

Externalurl=HTTPS://btcpay.freedomnode.com

Change the server name to your own name again.

You can also remove bind=0.0.0.0 from the configuration because remote connections will be proxied through Apache from now on.

Restart BTCPayServer:

Sudo service btcpayserver restart

Open a browser and check that the newly installed SSL certificate is working properly.

=

Share some interactive online programming hands-on tutorials related to Bitcoin, Ethernet Square, EOS, Fabric, etc.:

Java Bitcoin Development course, for beginners, covers the core concepts of Bitcoin, such as blockchain storage, decentralized consensus mechanisms, keys and scripts, transactions and UTXO, etc., as well as how to integrate Bitcoin support functions into Java code, such as creating addresses, managing wallets, constructing naked transactions, etc., is a rare bitcoin development course for Java engineers.

Php Bitcoin Development course, for beginners, covers the core concepts of Bitcoin, such as blockchain storage, decentralized consensus mechanisms, keys and scripts, transactions and UTXO, etc., as well as how to integrate Bitcoin support functions into Php code, such as creating addresses, managing wallets, constructing naked transactions, etc., is a rare bitcoin development course for Php engineers.

C # Bitcoin Development course, for beginners, covers the core concepts of Bitcoin, such as blockchain storage, decentralized consensus mechanisms, keys and scripts, transactions and UTXO, etc., as well as how to integrate Bitcoin support functions into C # code, such as creating addresses, managing wallets, constructing naked transactions, etc., is a rare Bitcoin development course for C # engineers.

The java ethernet development tutorial is mainly for java and android programmers to conduct a detailed web3j explanation of blockchain ethernet development.

Python ethernet, mainly for python engineers to use web3.py for block chain ethernet development of the detailed explanation.

Php Ethernet Square, mainly introduces the use of php for intelligent contract development interaction, account creation, transaction, transfer, token development, filter and transaction and so on.

Introduction to Ethernet Square tutorial, mainly introduces the intelligent contract and dapp application development, suitable for entry.

Yi Tai Fang development advanced tutorial, mainly introduces the use of node.js, mongodb, block chain, ipfs to achieve decentralized e-commerce DApp practice, suitable for advanced.

ERC721 focuses on Taifang pass practice, and the course focuses on the practical development of a digital art creation and sharing DApp. It deeply explains the concept, standard and development scheme of ethernet non-homogenization pass. The content includes the independent implementation of ERC-721 standard, explains the secondary development of OpenZeppelin contract code base, the actual combat project adopts Truffle,IPFS, and realizes the pass and decentralized stock exchange.

C # Ethernet Square, mainly explains how to use C # to develop .net-based Ethernet Square applications, including account management, status and transactions, intelligent contract development and interaction, filters and transactions, etc.

EOS introduction course, this course helps you quickly get started with the development of EOS block chain decentralized applications, covering core knowledge points such as EOS tool chain, accounts and wallets, issuing tokens, smart contract development and deployment, using code and intelligent contract interaction, and finally using all knowledge points to complete the development of a note DApp.

Play with EOS wallet development. This course focuses on the complete development process of mobile EOS wallet, and deeply studies the application development of EOS blockchain. The course covers the core concepts of EOS blockchain, such as accounts, computing resources, intelligent contracts, actions and transactions. It also explains how to use eosjs and eosjs-ecc development packages to access EOS blockchain, and how to integrate EOS blockchain support in React front-end applications. The content of the course is profound and simple, which is very suitable for front-end engineers to study the application development of EOS block chain.

This course is for beginners. It includes core concepts such as Hyperledger Fabric identity certificate and MSP service, permission policy, channel configuration and startup, chain code communication interface, as well as Fabric network design, nodejs chain code and application development. It is the best choice for Nodejs engineers to learn Fabric block chain development.

The course is aimed at beginners, including Hyperledger Fabric identity certificate and MSP service, permission policy, channel configuration and startup, chain code communication interface and other core concepts, as well as the operation practice of Fabric network design, java chain code and application development. It is the best choice for java engineers to learn Fabric block chain development.

Tendermint block chain development detailed understanding, this course is suitable for engineers who want to use tendermint for block chain development, the course content includes the core concepts of tendermint application development model, such as ABCI interface, Merkel tree, multi-version state library, etc., as well as rich practical code such as token issuance, it is the best choice for go language engineers to get started with block chain development.

After reading the above, do you have any further understanding of how to install BTCPayServer in Linux? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report