blob: 94a576c81dee2d43024368165d6b41150f548c57 [file] [log] [blame]
Marian Harbachebeb1542019-12-13 10:42:46 +01001:linkattrs:
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002= Gerrit Code Review - Standalone Daemon Installation Guide
Shawn O. Pearced2b73db2009-01-09 11:55:47 -08003
Janet Davies0c1a6212018-05-09 15:18:57 -07004[[prerequisites]]
5== Prerequisites
6
7To run the Gerrit service, the following requirement must be met on the host:
Fredrik Luthander833aa742011-10-27 21:07:46 +02008
David Pursehousea767f082020-01-10 14:20:23 +09009* JRE, versions 1.8 or 11 http://www.oracle.com/technetwork/java/javase/downloads/index.html[Download,role=external,window=_blank]
Gert van Dijka9d55112018-08-16 12:07:13 +020010+
David Ostrovsky841e3922020-01-09 01:05:05 +010011Gerrit is not yet compatible with Java 13 or newer at this time.
Fredrik Luthander833aa742011-10-27 21:07:46 +020012
Mark Derricuttde6c16d2014-03-25 13:45:05 +130013[[cryptography]]
14== Configure Java for Strong Cryptography
Janet Davies0c1a6212018-05-09 15:18:57 -070015
Mark Derricuttde6c16d2014-03-25 13:45:05 +130016Support for extra strength cryptographic ciphers: _AES128CTR_, _AES256CTR_,
17_ARCFOUR256_, and _ARCFOUR128_ can be enabled by downloading the _Java
18Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files_
19from Oracle and installing them into your JRE.
20
Michael Ochmann8129ece2016-07-08 11:25:25 +020021[NOTE]
22Installing JCE extensions is optional and export restrictions may apply.
Mark Derricuttde6c16d2014-03-25 13:45:05 +130023
24. Download the unlimited strength JCE policy files.
25+
Marian Harbach34253372019-12-10 18:01:31 +010026- link:http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html[JDK7 JCE policy files,role=external,window=_blank]
27- link:http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html[JDK8 JCE policy files,role=external,window=_blank]
Mark Derricuttde6c16d2014-03-25 13:45:05 +130028. Uncompress and extract the downloaded file.
29+
30The downloaded file contains the following files:
31+
32[cols="2"]
33|===
34|README.txt
35|Information about JCE and installation guide
36
37|local_policy.jar
38|Unlimited strength local policy file
39
40|US_export_policy.jar
41|Unlimited strength US export policy file
42|===
43. Install the unlimited strength policy JAR files by following instructions
44found in `README.txt`.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080045
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080046[[download]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080047== Download Gerrit
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080048
Shawn O. Pearce31af1ff2009-01-26 12:04:41 -080049Current and past binary releases of Gerrit can be obtained from
Philip Browne3aa8b12019-06-21 21:24:41 +000050the link:https://gerrit-releases.storage.googleapis.com/index.html[
Marian Harbach34253372019-12-10 18:01:31 +010051Gerrit Releases site,role=external,window=_blank].
Shawn O. Pearce31af1ff2009-01-26 12:04:41 -080052
Shawn O. Pearce8ddb8cb2009-09-28 12:21:28 -070053Download any current `*.war` package. The war will be referred to as
54`gerrit.war` from this point forward, so you may find it easier to
Anthonyd3aed4c2009-09-26 13:48:10 -040055rename the downloaded file.
Shawn O. Pearceb8527ea2009-02-02 15:39:12 -080056
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080057If you would prefer to build Gerrit directly from source, review
58the notes under link:dev-readme.html[developer setup].
Shawn O. Pearce31af1ff2009-01-26 12:04:41 -080059
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080060[[init]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080061== Initialize the Site
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080062
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080063Gerrit stores configuration files, the server's SSH keys, and the
64managed Git repositories under a local directory, typically referred
Dave Borowitzada289c2018-12-18 13:24:14 -080065to as `'$site_path'`.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080066
Fredrik Luthander833aa742011-10-27 21:07:46 +020067You also have to decide where to store your server side git repositories. This
68can either be a relative path under `'$site_path'` or an absolute path
69anywhere on your server system. You have to choose a place before commencing
70your init phase.
71
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080072Initialize a new site directory by running the init command, passing
73the path of the site directory to be created as an argument to the
74'-d' option. Its recommended that Gerrit Code Review be given its
75own user account on the host system:
76
77----
David Pursehouse64df83a2017-07-04 21:20:47 +090078 sudo adduser gerrit
79 sudo su gerrit
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080080
Fredrik Luthander833aa742011-10-27 21:07:46 +020081 java -jar gerrit.war init -d /path/to/your/gerrit_application_directory
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080082----
83
Michael Ochmann8129ece2016-07-08 11:25:25 +020084[NOTE]
85If you choose a location where your new user doesn't
Fredrik Luthander833aa742011-10-27 21:07:46 +020086have any privileges, you may have to manually create the directory first and
David Pursehouse64df83a2017-07-04 21:20:47 +090087then give ownership of that location to the `'gerrit'` user.
Fredrik Luthander833aa742011-10-27 21:07:46 +020088
89If run from an interactive terminal, the init command will prompt through a
Dave Borowitzada289c2018-12-18 13:24:14 -080090series of configuration questions. If the terminal is not interactive,
91running the init command will choose some reasonable default selections.
92Once the init phase is complete, you can review your settings in the file
93`'$site_path/etc/gerrit.config'`.
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080094
Fredrik Luthander833aa742011-10-27 21:07:46 +020095When running the init command, additional JARs might be downloaded to
96support optional selected functionality. If a download fails a URL will
97be displayed and init will wait for the user to manually download the JAR
98and store it in the target location.
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080099
Fredrik Luthander833aa742011-10-27 21:07:46 +0200100When the init phase is complete, the daemon will be automatically started
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800101in the background and your web browser will open to the site:
102
103----
David Pursehouse64df83a2017-07-04 21:20:47 +0900104 Initialized /home/gerrit/review_site
105 Executing /home/gerrit/review_site/bin/gerrit.sh start
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800106 Starting Gerrit Code Review: OK
107 Waiting for server to start ... OK
108 Opening browser ...
109----
110
111When the browser opens, sign in to Gerrit through the web interface.
112The first user to sign-in and register an account will be
113automatically placed into the fully privileged Administrators group,
114permitting server management over the web and over SSH. Subsequent
115users will be automatically registered as unprivileged users.
116
117
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800118== Installation Complete
Fredrik Luthander833aa742011-10-27 21:07:46 +0200119
120Your base Gerrit server is now installed and running. You're now ready to
121either set up more projects or start working with the projects you've already
122imported.
123
124
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800125[[project_setup]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800126== Project Setup
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800127
Stefan Lay08ba4732014-05-05 16:36:12 +0200128See link:project-configuration.html[Project Configuration] for further details on
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800129how to register a new project with Gerrit. This step is necessary
130if existing Git repositories were not imported during 'init'.
131
132
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100133[[rc_d]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800134== Start/Stop Daemon
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800135
136To control the Gerrit Code Review daemon that is running in the
137background, use the rc.d style start script created by 'init':
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800138
Michael Ochmannb99feab2016-07-06 14:10:22 +0200139----
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800140 review_site/bin/gerrit.sh start
141 review_site/bin/gerrit.sh stop
142 review_site/bin/gerrit.sh restart
Michael Ochmannb99feab2016-07-06 14:10:22 +0200143----
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800144
David Pursehouse626f8b52013-10-24 13:10:56 +0900145('Optional') Configure the daemon to automatically start and stop
146with the operating system.
147
148Uncomment the following 3 lines in the `'$site_path/bin/gerrit.sh'`
149script:
150
Michael Ochmannb99feab2016-07-06 14:10:22 +0200151----
David Pursehouse626f8b52013-10-24 13:10:56 +0900152 chkconfig: 3 99 99
153 description: Gerrit Code Review
154 processname: gerrit
Michael Ochmannb99feab2016-07-06 14:10:22 +0200155----
David Pursehouse626f8b52013-10-24 13:10:56 +0900156
157Then link the `gerrit.sh` script into `rc3.d`:
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800158
Michael Ochmannb99feab2016-07-06 14:10:22 +0200159----
Kyle Laker839edfc2013-03-08 01:05:10 -0500160 sudo ln -snf `pwd`/review_site/bin/gerrit.sh /etc/init.d/gerrit
161 sudo ln -snf /etc/init.d/gerrit /etc/rc3.d/S90gerrit
Michael Ochmannb99feab2016-07-06 14:10:22 +0200162----
Shawn O. Pearce86816ee2009-05-13 17:37:20 -0700163
David Pursehousebe284992013-09-26 14:43:33 +0900164('Optional') To enable autocompletion of the gerrit.sh commands, install
165autocompletion from the `/contrib/bash_completion` script. Refer to the
166script's header comments for installation instructions.
167
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800168To install Gerrit into an existing servlet container instead of using
169the embedded Jetty server, see
170link:install-j2ee.html[J2EE installation].
Shawn O. Pearce86816ee2009-05-13 17:37:20 -0700171
Rafal Klys6c454be2016-01-12 00:08:29 +0100172[[installation_on_windows]]
173== Installation on Windows
174
Gert van Dijk47b0ed32018-01-12 10:03:52 +0100175The `ssh-keygen` command must be available during the init phase to
176generate SSH host keys. If you have
Marian Harbach34253372019-12-10 18:01:31 +0100177link:https://git-for-windows.github.io/[Git for Windows,role=external,window=_blank] installed,
Rafal Klys6c454be2016-01-12 00:08:29 +0100178start Command Prompt and temporary add directory with ssh-keygen to the
179PATH environment variable just before running init command:
180
181====
182 PATH=%PATH%;c:\Program Files\Git\usr\bin
183====
184
185Please note that the path in the above example must not be
186double-quoted.
187
188To run the daemon after site initialization execute:
189
190====
191 cd C:\MY\GERRIT\SITE
192 java.exe -jar bin\gerrit.war daemon --console-log
193====
194
195To stop the daemon press Ctrl+C.
196
197=== Install the daemon as Windows Service
198
199To install Gerrit as Windows Service use the
200link:http://commons.apache.org/proper/commons-daemon/procrun.html[Apache
Marian Harbach34253372019-12-10 18:01:31 +0100201Commons Daemon Procrun,role=external,window=_blank].
Rafal Klys6c454be2016-01-12 00:08:29 +0100202
203Sample install command:
204
205====
206 prunsrv.exe //IS//Gerrit --DisplayName="Gerrit Code Review" --Startup=auto ^
207 --Jvm="C:\Program Files\Java\jre1.8.0_65\bin\server\jvm.dll" ^
208 --Classpath=C:\MY\GERRIT\SITE\bin\gerrit.war ^
209 --LogPath=C:\MY\GERRIT\SITE\logs ^
210 --StartPath=C:\MY\GERRIT\SITE ^
211 --StartMode=jvm --StopMode=jvm ^
212 --StartClass=com.google.gerrit.launcher.GerritLauncher --StartMethod=daemonStart ^
Edwin Kempin64a87762018-12-10 13:38:21 +0100213 --StopClass=com.google.gerrit.launcher.GerritLauncher --StopMethod=daemonStop
Rafal Klys6c454be2016-01-12 00:08:29 +0100214====
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800215
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800216[[customize]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800217== Site Customization
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800218
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800219Gerrit Code Review supports some site-specific customization options.
David Pursehouse221d4f62012-06-08 17:38:08 +0900220For more information, see the related topics in this manual:
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800221
Francois Marierd550b462011-04-13 14:30:20 +1200222* link:config-reverseproxy.html[Reverse Proxy]
Shawn O. Pearcef384b442009-01-10 16:20:56 -0800223* link:config-sso.html[Single Sign-On Systems]
Dave Borowitz1e49e142013-04-09 12:14:57 -0700224* link:config-themes.html[Themes]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800225* link:config-gitweb.html[Gitweb Integration]
Shawn O. Pearce7b405712009-05-08 18:27:53 -0700226* link:config-gerrit.html[Other System Settings]
Sasa Zivkove5fc90e2013-05-10 15:12:13 +0200227* link:config-auto-site-initialization.html[Automatic Site Initialization on Startup]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800228
Shawn O. Pearce0b91a632009-02-06 12:53:59 -0800229
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800230[[anonymous_access]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800231== Anonymous Access
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800232
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800233Exporting the Git repository directory
234(link:config-gerrit.html#gerrit.basePath[gerrit.basePath]) over the
235anonymous, unencrypted git:// protocol is more efficient than
236Gerrit's internal SSH daemon. See the `git-daemon` documentation
237for details on how to configure this if anonymous access is desired.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800238
Marian Harbach34253372019-12-10 18:01:31 +0100239* http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[man git-daemon,role=external,window=_blank]
Shawn O. Pearceb546c9b2009-02-24 13:12:39 -0800240
241
Martin Fick472bb9d2012-05-08 16:30:16 -0700242[[plugins]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800243== Plugins
Martin Fick472bb9d2012-05-08 16:30:16 -0700244
245Place Gerrit plugins in the review_site/plugins directory to have them loaded on Gerrit startup.
246
247
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800248== External Documentation Links
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800249
Marian Harbach34253372019-12-10 18:01:31 +0100250* http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[git-daemon,role=external,window=_blank]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800251
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700252
Matthias Sohn0d213562019-11-29 02:01:56 +0100253[[backup]]
254== Backup
255
256See the link:backup.html[backup documentation].
257
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700258GERRIT
259------
260Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700261
262SEARCHBOX
263---------