This document guides you step by step on how to run BitcartCC on a Raspberry Pi 4. See here the Raspberry Pi 3 instructions
The newly released Raspberry Pi 4 is currently the best low-cost single-board computer available. You can use a Raspberry Pi 4 to run your BitcartCC at home for around $130 worth of parts, described below.
Raspberry Pi 4 with 2GB RAM ($45)
Sandisk 16GB SD Card ($5)
You can use 1GB RAM or 4GB RAM versions too, it's up to you to pick your configuration. The 2GB RAM build is the golden middle between minimal and the best requirements. You’ll also need an SD card reader if you don’t already have one.
Don’t waste your time with random Chinese power adapters from Amazon, or expect that the existing ones you have at home are going to work fine. The Raspberry Pi 4 has issues with unofficial adapters, and for only $10 it’s better to just get an official adapter instead of learning this the hard way.
Pimoroni Fan Shim ($10)
Strictly speaking, you don’t actually need a cooling solution, but you certainly want a cooling solution, because if the Raspberry PI core temperature reaches 70C, it will throttle the CPU down to avoid burning itself up.
Flirc Heatsink Case ($12)
Pimoroni Pibow Coupé 4 ($9)
Of course, using a case is totally optional, but we recommend one to protect your Raspberry Pi over the long-term and prevent random dust from shorting out the pins.
Samsung 250GB SSD ($75)
The 250GB SSD allows you to keep BitcartCC up and running forever plus anything else you might want to do on your Pi. The performance will be amazing. Actually you don't need a lot of disk space, only 10 GB is actually required, so pick your own components, depending on what do you want to do.
Display ($100)
Important: Attach a heatsink to the CPU! 🔥🔥🔥
Connect the SSD to one of the blue colored USB 3 ports
Prepare the USB Power Adapter but don’t plug it in yet
Start by downloading Raspbian Linux to your existing computer. The “Lite” distribution is fine for BitcartCC setup, but if you want to use your Raspberry Pi for other things, you might want the full image.
Extract the downloaded Raspbian Linux zip file
Download the latest version of balenaEtcher and install it.
Connect an SD card reader with the SD card inside.
Open balenaEtcher and select from your hard drive the Raspberry Pi .img from the extracted zip file you wish to write to the SD card.
Select the SD card you wish to write your image to.
Review your selections and click 'Flash!' to begin writing data to the SD card.
You can find a more in-depth instruction guide to flashing to your SD card at the official Raspberry Pi website.
If you used balenaEtcher to flash, the SD card will already have been ejected. Simply take the SD card out and put it back in. The SD card should now be labelled as boot
. Next, enable SSH at bootup so you can remotely login by creating an empty file in the SD card root folder called ssh
. Eject the SD card through your OS before taking it out of the SD card reader.
After inserting the SD card into the Raspberry Pi, go ahead and connect the power and ethernet, and optionally the display and keyboard if you have those. It should boot up and get an IP address using DHCP. You can try searching for it with ping raspberrypi.local
on your desktop PC, but if that doesn’t work you will need to login to your router to find its IP address.
The IP address that my Raspberry Pi got was 192.168.1.5 so I SSH’d to that:
ssh 192.168.1.5 -l pi
The default password for the “pi” user is “raspberry”. After SSH’ing in, the first thing I want to do is check the device’s CPU temperature to make sure the cooling system are working correctly:
sudo -svcgencmd measure_temp
Next, let’s change the password for the “pi” user:
passwd pi
After that, switch to the root
user, which we will use for the remaining part of the tutorial:
sudo su -
We recommend to disable swap to prevent burning out your SD card:
dphys-swapfile swapoffdphys-swapfile uninstallupdate-rc.d dphys-swapfile removesystemctl disable dphys-swapfile
Partition your SSD:
fdisk /dev/sda# type 'p' to list existing partitions# type 'd' to delete currently selected partitions# type 'n' to create a new partition# type 'w' to write the new partition table and exit fdisk
Format the new partition on your SSD:
mkfs.ext4 /dev/sda1
Configure the SSD partition to auto-mount at bootup:
mkfs.ext4 /dev/sda1mkdir /mnt/usbUUID="$(sudo blkid -s UUID -o value /dev/sda1)"echo "UUID=$UUID /mnt/usb ext4 defaults,noatime,nofail 0" | sudo tee -a /etc/fstabmount -a
While you’re editing /etc/fstab
add a RAM filesystem for logs (optional). This is also to prevent burning out your SD card too quickly:
echo 'none /var/log tmpfs size=10M,noatime 00' >> /etc/fstab
Mount the SSD partition and create a symlink for docker to use the SSD:
mkdir /mnt/usb/dockerln -s /mnt/usb/docker /var/lib/docker
Upgrade your OS packages to the latest versions:
apt update && apt upgrade -y && apt autoremove
Install a firewall and allow SSH, HTTP, HTTPS:
apt install -y ufwufw default deny incomingufw default allow outgoing
This command allows SSH connections from internal networks only:
ufw allow from 10.0.0.0/8 to any port 22 proto tcpufw allow from 172.16.0.0/12 to any port 22 proto tcpufw allow from 192.168.0.0/16 to any port 22 proto tcpufw allow from 169.254.0.0/16 to any port 22 proto tcpufw allow from fc00::/7 to any port 22 proto tcpufw allow from fe80::/10 to any port 22 proto tcpufw allow from ff00::/8 to any port 22 proto tcp
These ports need to be accessible from anywhere (The default subnet is 'any' unless you specify one):
ufw allow 80/tcpufw allow 443/tcp
Verify your configuration:
ufw status
Enable your firewall:
ufw enable
Download BitcartCC from GitHub:
cd # ensure we are in root homeapt install -y fail2ban gitgit clone https://github.com/bitcartcc/bitcart-dockercd bitcart-docker
Configure BitcartCC by setting some environment variables:
export BITCART_HOST="api.raspberrypi.local"export BITCART_ADMIN_HOST="admin.raspberrypi.local"export BITCART_STORE_HOST="raspberrypi.local"export BITCART_STORE_API_URL="http://api.raspberrypi.local"export BITCART_ADMIN_API_URL="http://api.raspberrypi.local"export BITCART_REVERSEPROXY="nginx"export BTC_LIGHTNING=true
In case you want to restrict access to your local network only, please note that you need to use a .local
domain.
Run the BitcartCC installation:
./setup.sh./start.sh
It should be up and running within a few minutes. Try opening http://admin.raspberrypi.local in your web browser. If everything is correct, you will see BitcartCC front page.