1 *** Warning: This document has not been updated for Zcash and may be inaccurate. ***
3 Sample init scripts and service configuration for bitcoind
4 ==========================================================
6 Sample scripts and configuration files for systemd, Upstart and OpenRC
7 can be found in the contrib/init folder.
9 contrib/init/bitcoind.service: systemd service unit configuration
10 contrib/init/bitcoind.openrc: OpenRC compatible SysV style init script
11 contrib/init/bitcoind.openrcconf: OpenRC conf.d file
12 contrib/init/bitcoind.conf: Upstart service configuration file
13 contrib/init/bitcoind.init: CentOS compatible SysV style init script
16 ---------------------------------
18 All three startup configurations assume the existence of a "bitcoin" user
19 and group. They must be created before attempting to use these scripts.
22 ---------------------------------
24 At a bare minimum, bitcoind requires that the rpcpassword setting be set
25 when running as a daemon. If the configuration file does not exist or this
26 setting is not set, bitcoind will shutdown promptly after startup.
28 This password does not have to be remembered or typed as it is mostly used
29 as a fixed token that bitcoind and client programs read from the configuration
30 file, however it is recommended that a strong and secure password be used
31 as this password is security critical to securing the wallet should the
34 If bitcoind is run with "-daemon" flag, and no rpcpassword is set, it will
35 print a randomly generated suitable password to stderr. You can also
36 generate one from the shell yourself like this:
38 bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'
41 For an example configuration file that describes the configuration settings,
42 see contrib/debian/examples/bitcoin.conf.
45 ---------------------------------
47 All three configurations assume several paths that might need to be adjusted.
49 Binary: /usr/bin/bitcoind
50 Configuration file: /etc/bitcoin/bitcoin.conf
51 Data directory: /var/lib/bitcoind
52 PID file: /var/run/bitcoind/bitcoind.pid (OpenRC and Upstart)
53 /var/lib/bitcoind/bitcoind.pid (systemd)
54 Lock file: /var/lock/subsys/bitcoind (CentOS)
56 The configuration file, PID directory (if applicable) and data directory
57 should all be owned by the bitcoin user and group. It is advised for security
58 reasons to make the configuration file and data directory only readable by the
59 bitcoin user and group. Access to bitcoin-cli and other bitcoind rpc clients
60 can then be controlled by group membership.
62 4. Installing Service Configuration
63 -----------------------------------
67 Installing this .service file consists of just copying it to
68 /usr/lib/systemd/system directory, followed by the command
69 "systemctl daemon-reload" in order to update running systemd configuration.
71 To test, run "systemctl start bitcoind" and to enable for system startup run
72 "systemctl enable bitcoind"
76 Rename bitcoind.openrc to bitcoind and drop it in /etc/init.d. Double
77 check ownership and permissions and make it executable. Test it with
78 "/etc/init.d/bitcoind start" and configure it to run on startup with
79 "rc-update add bitcoind"
81 4c) Upstart (for Debian/Ubuntu based distributions)
83 Drop bitcoind.conf in /etc/init. Test by running "service bitcoind start"
84 it will automatically start on reboot.
86 NOTE: This script is incompatible with CentOS 5 and Amazon Linux 2014 as they
87 use old versions of Upstart and do not supply the start-stop-daemon utility.
91 Copy bitcoind.init to /etc/init.d/bitcoind. Test by running "service bitcoind start".
93 Using this script, you can adjust the path and flags to the bitcoind program by
94 setting the BITCOIND and FLAGS environment variables in the file
95 /etc/sysconfig/bitcoind. You can also use the DAEMONOPTS environment variable here.
98 -----------------------------------
100 Auto respawning is currently only configured for Upstart and systemd.
101 Reasonable defaults have been chosen but YMMV.