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