Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1 | = Gerrit Code Review - Standalone Daemon Installation Guide |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 2 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 3 | [[prerequisites]] |
| 4 | == Prerequisites |
| 5 | |
| 6 | To run the Gerrit service, the following requirement must be met on the host: |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 7 | |
David Ostrovsky | 841e392 | 2020-01-09 01:05:05 +0100 | [diff] [blame] | 8 | * JRE, versions 1.8 or 11 http://www.oracle.com/technetwork/java/javase/downloads/index.html[Download] |
Gert van Dijk | a9d5511 | 2018-08-16 12:07:13 +0200 | [diff] [blame] | 9 | + |
David Ostrovsky | 841e392 | 2020-01-09 01:05:05 +0100 | [diff] [blame] | 10 | Gerrit is not yet compatible with Java 13 or newer at this time. |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 11 | |
Mark Derricutt | de6c16d | 2014-03-25 13:45:05 +1300 | [diff] [blame] | 12 | [[cryptography]] |
| 13 | == Configure Java for Strong Cryptography |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 14 | |
Mark Derricutt | de6c16d | 2014-03-25 13:45:05 +1300 | [diff] [blame] | 15 | Support for extra strength cryptographic ciphers: _AES128CTR_, _AES256CTR_, |
| 16 | _ARCFOUR256_, and _ARCFOUR128_ can be enabled by downloading the _Java |
| 17 | Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files_ |
| 18 | from Oracle and installing them into your JRE. |
| 19 | |
Michael Ochmann | 8129ece | 2016-07-08 11:25:25 +0200 | [diff] [blame] | 20 | [NOTE] |
| 21 | Installing JCE extensions is optional and export restrictions may apply. |
Mark Derricutt | de6c16d | 2014-03-25 13:45:05 +1300 | [diff] [blame] | 22 | |
| 23 | . Download the unlimited strength JCE policy files. |
| 24 | + |
| 25 | - link:http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html[JDK7 JCE policy files] |
| 26 | - link:http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html[JDK8 JCE policy files] |
| 27 | . Uncompress and extract the downloaded file. |
| 28 | + |
| 29 | The downloaded file contains the following files: |
| 30 | + |
| 31 | [cols="2"] |
| 32 | |=== |
| 33 | |README.txt |
| 34 | |Information about JCE and installation guide |
| 35 | |
| 36 | |local_policy.jar |
| 37 | |Unlimited strength local policy file |
| 38 | |
| 39 | |US_export_policy.jar |
| 40 | |Unlimited strength US export policy file |
| 41 | |=== |
| 42 | . Install the unlimited strength policy JAR files by following instructions |
| 43 | found in `README.txt`. |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 44 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 45 | [[download]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 46 | == Download Gerrit |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 47 | |
Shawn O. Pearce | 31af1ff | 2009-01-26 12:04:41 -0800 | [diff] [blame] | 48 | Current and past binary releases of Gerrit can be obtained from |
Philip Brown | e3aa8b1 | 2019-06-21 21:24:41 +0000 | [diff] [blame] | 49 | the link:https://gerrit-releases.storage.googleapis.com/index.html[ |
David Pursehouse | 8d2b4a0 | 2013-10-18 11:01:28 +0900 | [diff] [blame] | 50 | Gerrit Releases site]. |
Shawn O. Pearce | 31af1ff | 2009-01-26 12:04:41 -0800 | [diff] [blame] | 51 | |
Shawn O. Pearce | 8ddb8cb | 2009-09-28 12:21:28 -0700 | [diff] [blame] | 52 | Download any current `*.war` package. The war will be referred to as |
| 53 | `gerrit.war` from this point forward, so you may find it easier to |
Anthony | d3aed4c | 2009-09-26 13:48:10 -0400 | [diff] [blame] | 54 | rename the downloaded file. |
Shawn O. Pearce | b8527ea | 2009-02-02 15:39:12 -0800 | [diff] [blame] | 55 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 56 | If you would prefer to build Gerrit directly from source, review |
| 57 | the notes under link:dev-readme.html[developer setup]. |
Shawn O. Pearce | 31af1ff | 2009-01-26 12:04:41 -0800 | [diff] [blame] | 58 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 59 | [[init]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 60 | == Initialize the Site |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 61 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 62 | Gerrit stores configuration files, the server's SSH keys, and the |
| 63 | managed Git repositories under a local directory, typically referred |
Dave Borowitz | ada289c | 2018-12-18 13:24:14 -0800 | [diff] [blame] | 64 | to as `'$site_path'`. |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 65 | |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 66 | You also have to decide where to store your server side git repositories. This |
| 67 | can either be a relative path under `'$site_path'` or an absolute path |
| 68 | anywhere on your server system. You have to choose a place before commencing |
| 69 | your init phase. |
| 70 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 71 | Initialize a new site directory by running the init command, passing |
| 72 | the path of the site directory to be created as an argument to the |
| 73 | '-d' option. Its recommended that Gerrit Code Review be given its |
| 74 | own user account on the host system: |
| 75 | |
| 76 | ---- |
David Pursehouse | 64df83a | 2017-07-04 21:20:47 +0900 | [diff] [blame] | 77 | sudo adduser gerrit |
| 78 | sudo su gerrit |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 79 | |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 80 | java -jar gerrit.war init -d /path/to/your/gerrit_application_directory |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 81 | ---- |
| 82 | |
Michael Ochmann | 8129ece | 2016-07-08 11:25:25 +0200 | [diff] [blame] | 83 | [NOTE] |
| 84 | If you choose a location where your new user doesn't |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 85 | have any privileges, you may have to manually create the directory first and |
David Pursehouse | 64df83a | 2017-07-04 21:20:47 +0900 | [diff] [blame] | 86 | then give ownership of that location to the `'gerrit'` user. |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 87 | |
| 88 | If run from an interactive terminal, the init command will prompt through a |
Dave Borowitz | ada289c | 2018-12-18 13:24:14 -0800 | [diff] [blame] | 89 | series of configuration questions. If the terminal is not interactive, |
| 90 | running the init command will choose some reasonable default selections. |
| 91 | Once the init phase is complete, you can review your settings in the file |
| 92 | `'$site_path/etc/gerrit.config'`. |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 93 | |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 94 | When running the init command, additional JARs might be downloaded to |
| 95 | support optional selected functionality. If a download fails a URL will |
| 96 | be displayed and init will wait for the user to manually download the JAR |
| 97 | and store it in the target location. |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 98 | |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 99 | When the init phase is complete, the daemon will be automatically started |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 100 | in the background and your web browser will open to the site: |
| 101 | |
| 102 | ---- |
David Pursehouse | 64df83a | 2017-07-04 21:20:47 +0900 | [diff] [blame] | 103 | Initialized /home/gerrit/review_site |
| 104 | Executing /home/gerrit/review_site/bin/gerrit.sh start |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 105 | Starting Gerrit Code Review: OK |
| 106 | Waiting for server to start ... OK |
| 107 | Opening browser ... |
| 108 | ---- |
| 109 | |
| 110 | When the browser opens, sign in to Gerrit through the web interface. |
| 111 | The first user to sign-in and register an account will be |
| 112 | automatically placed into the fully privileged Administrators group, |
| 113 | permitting server management over the web and over SSH. Subsequent |
| 114 | users will be automatically registered as unprivileged users. |
| 115 | |
| 116 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 117 | == Installation Complete |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 118 | |
| 119 | Your base Gerrit server is now installed and running. You're now ready to |
| 120 | either set up more projects or start working with the projects you've already |
| 121 | imported. |
| 122 | |
| 123 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 124 | [[project_setup]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 125 | == Project Setup |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 126 | |
Stefan Lay | 08ba473 | 2014-05-05 16:36:12 +0200 | [diff] [blame] | 127 | See link:project-configuration.html[Project Configuration] for further details on |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 128 | how to register a new project with Gerrit. This step is necessary |
| 129 | if existing Git repositories were not imported during 'init'. |
| 130 | |
| 131 | |
Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 132 | [[rc_d]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 133 | == Start/Stop Daemon |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 134 | |
| 135 | To control the Gerrit Code Review daemon that is running in the |
| 136 | background, use the rc.d style start script created by 'init': |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 137 | |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 138 | ---- |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 139 | review_site/bin/gerrit.sh start |
| 140 | review_site/bin/gerrit.sh stop |
| 141 | review_site/bin/gerrit.sh restart |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 142 | ---- |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 143 | |
David Pursehouse | 626f8b5 | 2013-10-24 13:10:56 +0900 | [diff] [blame] | 144 | ('Optional') Configure the daemon to automatically start and stop |
| 145 | with the operating system. |
| 146 | |
| 147 | Uncomment the following 3 lines in the `'$site_path/bin/gerrit.sh'` |
| 148 | script: |
| 149 | |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 150 | ---- |
David Pursehouse | 626f8b5 | 2013-10-24 13:10:56 +0900 | [diff] [blame] | 151 | chkconfig: 3 99 99 |
| 152 | description: Gerrit Code Review |
| 153 | processname: gerrit |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 154 | ---- |
David Pursehouse | 626f8b5 | 2013-10-24 13:10:56 +0900 | [diff] [blame] | 155 | |
| 156 | Then link the `gerrit.sh` script into `rc3.d`: |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 157 | |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 158 | ---- |
Kyle Laker | 839edfc | 2013-03-08 01:05:10 -0500 | [diff] [blame] | 159 | sudo ln -snf `pwd`/review_site/bin/gerrit.sh /etc/init.d/gerrit |
| 160 | sudo ln -snf /etc/init.d/gerrit /etc/rc3.d/S90gerrit |
Michael Ochmann | b99feab | 2016-07-06 14:10:22 +0200 | [diff] [blame] | 161 | ---- |
Shawn O. Pearce | 86816ee | 2009-05-13 17:37:20 -0700 | [diff] [blame] | 162 | |
David Pursehouse | be28499 | 2013-09-26 14:43:33 +0900 | [diff] [blame] | 163 | ('Optional') To enable autocompletion of the gerrit.sh commands, install |
| 164 | autocompletion from the `/contrib/bash_completion` script. Refer to the |
| 165 | script's header comments for installation instructions. |
| 166 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 167 | To install Gerrit into an existing servlet container instead of using |
| 168 | the embedded Jetty server, see |
| 169 | link:install-j2ee.html[J2EE installation]. |
Shawn O. Pearce | 86816ee | 2009-05-13 17:37:20 -0700 | [diff] [blame] | 170 | |
Rafal Klys | 6c454be | 2016-01-12 00:08:29 +0100 | [diff] [blame] | 171 | [[installation_on_windows]] |
| 172 | == Installation on Windows |
| 173 | |
Gert van Dijk | 47b0ed3 | 2018-01-12 10:03:52 +0100 | [diff] [blame] | 174 | The `ssh-keygen` command must be available during the init phase to |
| 175 | generate SSH host keys. If you have |
Rafal Klys | 6c454be | 2016-01-12 00:08:29 +0100 | [diff] [blame] | 176 | link:https://git-for-windows.github.io/[Git for Windows] installed, |
| 177 | start Command Prompt and temporary add directory with ssh-keygen to the |
| 178 | PATH environment variable just before running init command: |
| 179 | |
| 180 | ==== |
| 181 | PATH=%PATH%;c:\Program Files\Git\usr\bin |
| 182 | ==== |
| 183 | |
| 184 | Please note that the path in the above example must not be |
| 185 | double-quoted. |
| 186 | |
| 187 | To run the daemon after site initialization execute: |
| 188 | |
| 189 | ==== |
| 190 | cd C:\MY\GERRIT\SITE |
| 191 | java.exe -jar bin\gerrit.war daemon --console-log |
| 192 | ==== |
| 193 | |
| 194 | To stop the daemon press Ctrl+C. |
| 195 | |
| 196 | === Install the daemon as Windows Service |
| 197 | |
| 198 | To install Gerrit as Windows Service use the |
| 199 | link:http://commons.apache.org/proper/commons-daemon/procrun.html[Apache |
| 200 | Commons Daemon Procrun]. |
| 201 | |
| 202 | Sample install command: |
| 203 | |
| 204 | ==== |
| 205 | prunsrv.exe //IS//Gerrit --DisplayName="Gerrit Code Review" --Startup=auto ^ |
| 206 | --Jvm="C:\Program Files\Java\jre1.8.0_65\bin\server\jvm.dll" ^ |
| 207 | --Classpath=C:\MY\GERRIT\SITE\bin\gerrit.war ^ |
| 208 | --LogPath=C:\MY\GERRIT\SITE\logs ^ |
| 209 | --StartPath=C:\MY\GERRIT\SITE ^ |
| 210 | --StartMode=jvm --StopMode=jvm ^ |
| 211 | --StartClass=com.google.gerrit.launcher.GerritLauncher --StartMethod=daemonStart ^ |
Edwin Kempin | 64a8776 | 2018-12-10 13:38:21 +0100 | [diff] [blame] | 212 | --StopClass=com.google.gerrit.launcher.GerritLauncher --StopMethod=daemonStop |
Rafal Klys | 6c454be | 2016-01-12 00:08:29 +0100 | [diff] [blame] | 213 | ==== |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 214 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 215 | [[customize]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 216 | == Site Customization |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 217 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 218 | Gerrit Code Review supports some site-specific customization options. |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 219 | For more information, see the related topics in this manual: |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 220 | |
Francois Marier | d550b46 | 2011-04-13 14:30:20 +1200 | [diff] [blame] | 221 | * link:config-reverseproxy.html[Reverse Proxy] |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 222 | * link:config-sso.html[Single Sign-On Systems] |
Dave Borowitz | 1e49e14 | 2013-04-09 12:14:57 -0700 | [diff] [blame] | 223 | * link:config-themes.html[Themes] |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 224 | * link:config-gitweb.html[Gitweb Integration] |
Shawn O. Pearce | 7b40571 | 2009-05-08 18:27:53 -0700 | [diff] [blame] | 225 | * link:config-gerrit.html[Other System Settings] |
Sasa Zivkov | e5fc90e | 2013-05-10 15:12:13 +0200 | [diff] [blame] | 226 | * link:config-auto-site-initialization.html[Automatic Site Initialization on Startup] |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 227 | |
Shawn O. Pearce | 0b91a63 | 2009-02-06 12:53:59 -0800 | [diff] [blame] | 228 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 229 | [[anonymous_access]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 230 | == Anonymous Access |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 231 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 232 | Exporting the Git repository directory |
| 233 | (link:config-gerrit.html#gerrit.basePath[gerrit.basePath]) over the |
| 234 | anonymous, unencrypted git:// protocol is more efficient than |
| 235 | Gerrit's internal SSH daemon. See the `git-daemon` documentation |
| 236 | for details on how to configure this if anonymous access is desired. |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 237 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 238 | * http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[man git-daemon] |
Shawn O. Pearce | b546c9b | 2009-02-24 13:12:39 -0800 | [diff] [blame] | 239 | |
| 240 | |
Martin Fick | 472bb9d | 2012-05-08 16:30:16 -0700 | [diff] [blame] | 241 | [[plugins]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 242 | == Plugins |
Martin Fick | 472bb9d | 2012-05-08 16:30:16 -0700 | [diff] [blame] | 243 | |
| 244 | Place Gerrit plugins in the review_site/plugins directory to have them loaded on Gerrit startup. |
| 245 | |
| 246 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 247 | == External Documentation Links |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 248 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 249 | * http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[git-daemon] |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 250 | |
Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 251 | |
Matthias Sohn | 0d21356 | 2019-11-29 02:01:56 +0100 | [diff] [blame] | 252 | [[backup]] |
| 253 | == Backup |
| 254 | |
| 255 | See the link:backup.html[backup documentation]. |
| 256 | |
Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 257 | GERRIT |
| 258 | ------ |
| 259 | Part of link:index.html[Gerrit Code Review] |
Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 260 | |
| 261 | SEARCHBOX |
| 262 | --------- |