Bitcoin Forum
May 02, 2024, 02:09:43 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Configuring bitcoin-core Snap package in Ubuntu Server 20.04  (Read 68 times)
CONFIDENCE_Man (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
February 27, 2021, 03:13:46 AM
 #1

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?
1714658983
Hero Member
*
Offline Offline

Posts: 1714658983

View Profile Personal Message (Offline)

Ignore
1714658983
Reply with quote  #2

1714658983
Report to moderator
BitcoinCleanup.com: Learn why Bitcoin isn't bad for the environment
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714658983
Hero Member
*
Offline Offline

Posts: 1714658983

View Profile Personal Message (Offline)

Ignore
1714658983
Reply with quote  #2

1714658983
Report to moderator
1714658983
Hero Member
*
Offline Offline

Posts: 1714658983

View Profile Personal Message (Offline)

Ignore
1714658983
Reply with quote  #2

1714658983
Report to moderator
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6720


bitcoincleanup.com / bitmixlist.org


View Profile WWW
March 02, 2021, 04:23:08 PM
 #2

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

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!