Author

Topic: Configuring bitcoin-core Snap package in Ubuntu Server 20.04 (Read 88 times)

legendary
Activity: 2870
Merit: 7490
Crypto Swap Exchange
By default, snap don't allow application to access external/removable storage. You might need to run this command to ensure Bitcoin Core can access /media/bitcoin_data

Code:
sudo snap connect bitcoin-core:removable-media
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
The first setting can be added into the bitcoin.conf file:

- To change the data directory, create a file called /home/bitcoin/.bitcoin/bitcoin.conf and inside it type the line

Code:
datadir=/media/bitcoin_data

As for starting at boot, there is no such option in bitcoin.conf, however you can make a systemd service that starts bitcoind as the "bitcoin" user at system startup.

1. In your VM create a file called bitcoind.service with the following contents:

Code:
[Unit]
Description=Run Bitcoin Core as daemon
Wants=network-online.target
After=network.target network-online.target

[Service]
Type=simple
# you may have to change the path of bitcoind
ExecStart=/usr/local/bin/bitcoind    # Add command line options here at your will
RemainAfterExit=no

[Install]
WantedBy=multi-user.target

2. Put this file in /usr/lib/systemd/system
3. Run the following commands:

Code:
sudo systemctl daemon-reload
sudo systemctl enable bitcoind.service
sudo systemctl start bitcoind.service  # alternatively just restart the VM
newbie
Activity: 1
Merit: 0
In order to take advantage of automatic updates, I've installed the bitcoin-core Snap package under Ubuntu Server 20.04 (no GUI) running on Microsoft Hyper-V Server 2019.

I need to be able to do the following:

  • Change the data directory to /media/bitcoin_data (ext4, a separate VHDX already mounted on startup to store all the data)
  • Run bitcoin-core.daemon at startup using the unprivileged system account 'bitcoin'.

I can't find any good guides on how to do this without installing the GUI to specify the data directory. (I've actually tried to install 'ubuntu-desktop' through Apt, but after a reboot of the VM, it just displays a blank cursor on the console. I'd rather not have a GUI on this VM anyhow.)

Does anyone else have such a setup that's working?
Jump to: