You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long. 5.1KB

  1. Sample init scripts and service configuration for bitcoind
  2. ==========================================================
  3. Sample scripts and configuration files for systemd, Upstart and OpenRC
  4. can be found in the contrib/init folder.
  5. contrib/init/bitcoind.service: systemd service unit configuration
  6. contrib/init/bitcoind.openrc: OpenRC compatible SysV style init script
  7. contrib/init/bitcoind.openrcconf: OpenRC conf.d file
  8. contrib/init/bitcoind.conf: Upstart service configuration file
  9. contrib/init/bitcoind.init: CentOS compatible SysV style init script
  10. Service User
  11. ---------------------------------
  12. All three Linux startup configurations assume the existence of a "bitcoin" user
  13. and group. They must be created before attempting to use these scripts.
  14. The OS X configuration assumes bitcoind will be set up for the current user.
  15. Configuration
  16. ---------------------------------
  17. At a bare minimum, bitcoind requires that the rpcpassword setting be set
  18. when running as a daemon. If the configuration file does not exist or this
  19. setting is not set, bitcoind will shutdown promptly after startup.
  20. This password does not have to be remembered or typed as it is mostly used
  21. as a fixed token that bitcoind and client programs read from the configuration
  22. file, however it is recommended that a strong and secure password be used
  23. as this password is security critical to securing the wallet should the
  24. wallet be enabled.
  25. If bitcoind is run with the "-server" flag (set by default), and no rpcpassword is set,
  26. it will use a special cookie file for authentication. The cookie is generated with random
  27. content when the daemon starts, and deleted when it exits. Read access to this file
  28. controls who can access it through RPC.
  29. By default the cookie is stored in the data directory, but it's location can be overridden
  30. with the option '-rpccookiefile'.
  31. This allows for running bitcoind without having to do any manual configuration.
  32. `conf`, `pid`, and `wallet` accept relative paths which are interpreted as
  33. relative to the data directory. `wallet` *only* supports relative paths.
  34. For an example configuration file that describes the configuration settings,
  35. see `contrib/debian/examples/bitcoin.conf`.
  36. Paths
  37. ---------------------------------
  38. ### Linux
  39. All three configurations assume several paths that might need to be adjusted.
  40. Binary: `/usr/bin/bitcoind`
  41. Configuration file: `/etc/bitcoin/bitcoin.conf`
  42. Data directory: `/var/lib/bitcoind`
  43. PID file: `/var/run/bitcoind/` (OpenRC and Upstart) or `/var/lib/bitcoind/` (systemd)
  44. Lock file: `/var/lock/subsys/bitcoind` (CentOS)
  45. The configuration file, PID directory (if applicable) and data directory
  46. should all be owned by the bitcoin user and group. It is advised for security
  47. reasons to make the configuration file and data directory only readable by the
  48. bitcoin user and group. Access to bitcoin-cli and other bitcoind rpc clients
  49. can then be controlled by group membership.
  50. ### Mac OS X
  51. Binary: `/usr/local/bin/bitcoind`
  52. Configuration file: `~/Library/Application Support/Bitcoin/bitcoin.conf`
  53. Data directory: `~/Library/Application Support/Bitcoin`
  54. Lock file: `~/Library/Application Support/Bitcoin/.lock`
  55. Installing Service Configuration
  56. -----------------------------------
  57. ### systemd
  58. Installing this .service file consists of just copying it to
  59. /usr/lib/systemd/system directory, followed by the command
  60. `systemctl daemon-reload` in order to update running systemd configuration.
  61. To test, run `systemctl start bitcoind` and to enable for system startup run
  62. `systemctl enable bitcoind`
  63. ### OpenRC
  64. Rename bitcoind.openrc to bitcoind and drop it in /etc/init.d. Double
  65. check ownership and permissions and make it executable. Test it with
  66. `/etc/init.d/bitcoind start` and configure it to run on startup with
  67. `rc-update add bitcoind`
  68. ### Upstart (for Debian/Ubuntu based distributions)
  69. Drop bitcoind.conf in /etc/init. Test by running `service bitcoind start`
  70. it will automatically start on reboot.
  71. NOTE: This script is incompatible with CentOS 5 and Amazon Linux 2014 as they
  72. use old versions of Upstart and do not supply the start-stop-daemon utility.
  73. ### CentOS
  74. Copy bitcoind.init to /etc/init.d/bitcoind. Test by running `service bitcoind start`.
  75. Using this script, you can adjust the path and flags to the bitcoind program by
  76. setting the BITCOIND and FLAGS environment variables in the file
  77. /etc/sysconfig/bitcoind. You can also use the DAEMONOPTS environment variable here.
  78. ### Mac OS X
  79. Copy org.bitcoin.bitcoind.plist into ~/Library/LaunchAgents. Load the launch agent by
  80. running `launchctl load ~/Library/LaunchAgents/org.bitcoin.bitcoind.plist`.
  81. This Launch Agent will cause bitcoind to start whenever the user logs in.
  82. NOTE: This approach is intended for those wanting to run bitcoind as the current user.
  83. You will need to modify org.bitcoin.bitcoind.plist if you intend to use it as a
  84. Launch Daemon with a dedicated bitcoin user.
  85. Auto-respawn
  86. -----------------------------------
  87. Auto respawning is currently only configured for Upstart and systemd.
  88. Reasonable defaults have been chosen but YMMV.