]> Git Repo - VerusCoin.git/blame - doc/init.md
Auto merge of #846 - DoNotUseThisCodeJUSTFORKS:automated-performance-measurement...
[VerusCoin.git] / doc / init.md
CommitLineData
234bfbf6
AW
1Sample init scripts and service configuration for bitcoind
2==========================================================
3
4Sample scripts and configuration files for systemd, Upstart and OpenRC
5can be found in the contrib/init folder.
6
41020ebe
W
7 contrib/init/bitcoind.service: systemd service unit configuration
8 contrib/init/bitcoind.openrc: OpenRC compatible SysV style init script
9 contrib/init/bitcoind.openrcconf: OpenRC conf.d file
10 contrib/init/bitcoind.conf: Upstart service configuration file
723664b5 11 contrib/init/bitcoind.init: CentOS compatible SysV style init script
234bfbf6
AW
12
131. Service User
14---------------------------------
15
16All three startup configurations assume the existence of a "bitcoin" user
17and group. They must be created before attempting to use these scripts.
18
192. Configuration
20---------------------------------
21
22At a bare minimum, bitcoind requires that the rpcpassword setting be set
23when running as a daemon. If the configuration file does not exist or this
24setting is not set, bitcoind will shutdown promptly after startup.
25
26This password does not have to be remembered or typed as it is mostly used
27as a fixed token that bitcoind and client programs read from the configuration
28file, however it is recommended that a strong and secure password be used
29as this password is security critical to securing the wallet should the
30wallet be enabled.
31
32If bitcoind is run with "-daemon" flag, and no rpcpassword is set, it will
33print a randomly generated suitable password to stderr. You can also
34generate one from the shell yourself like this:
35
36bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'
37
234bfbf6 38
4fbfebea 39For an example configuration file that describes the configuration settings,
234bfbf6
AW
40see contrib/debian/examples/bitcoin.conf.
41
423. Paths
43---------------------------------
44
45All three configurations assume several paths that might need to be adjusted.
46
47Binary: /usr/bin/bitcoind
48Configuration file: /etc/bitcoin/bitcoin.conf
49Data directory: /var/lib/bitcoind
50PID file: /var/run/bitcoind/bitcoind.pid (OpenRC and Upstart)
51 /var/lib/bitcoind/bitcoind.pid (systemd)
723664b5 52Lock file: /var/lock/subsys/bitcoind (CentOS)
234bfbf6
AW
53
54The configuration file, PID directory (if applicable) and data directory
55should all be owned by the bitcoin user and group. It is advised for security
56reasons to make the configuration file and data directory only readable by the
57bitcoin user and group. Access to bitcoin-cli and other bitcoind rpc clients
58can then be controlled by group membership.
59
604. Installing Service Configuration
61-----------------------------------
62
634a) systemd
64
7e6d23b1 65Installing this .service file consists of just copying it to
234bfbf6
AW
66/usr/lib/systemd/system directory, followed by the command
67"systemctl daemon-reload" in order to update running systemd configuration.
68
69To test, run "systemctl start bitcoind" and to enable for system startup run
70"systemctl enable bitcoind"
71
724b) OpenRC
73
74Rename bitcoind.openrc to bitcoind and drop it in /etc/init.d. Double
75check ownership and permissions and make it executable. Test it with
76"/etc/init.d/bitcoind start" and configure it to run on startup with
77"rc-update add bitcoind"
78
794c) Upstart (for Debian/Ubuntu based distributions)
80
81Drop bitcoind.conf in /etc/init. Test by running "service bitcoind start"
82it will automatically start on reboot.
83
84NOTE: This script is incompatible with CentOS 5 and Amazon Linux 2014 as they
723664b5 85use old versions of Upstart and do not supply the start-stop-daemon utility.
86
874d) CentOS
88
89Copy bitcoind.init to /etc/init.d/bitcoind. Test by running "service bitcoind start".
90
4fbfebea
MC
91Using this script, you can adjust the path and flags to the bitcoind program by
92setting the BITCOIND and FLAGS environment variables in the file
723664b5 93/etc/sysconfig/bitcoind. You can also use the DAEMONOPTS environment variable here.
234bfbf6
AW
94
955. Auto-respawn
96-----------------------------------
97
98Auto respawning is currently only configured for Upstart and systemd.
99Reasonable defaults have been chosen but YMMV.
100
This page took 0.076112 seconds and 4 git commands to generate.