blob: 09ebbba6cd7f3f101efcaa021f2431855ea23fa3 [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Gerrit Code Review - Standalone Daemon Installation Guide
Shawn O. Pearced2b73db2009-01-09 11:55:47 -08002
Janet Davies0c1a6212018-05-09 15:18:57 -07003[[prerequisites]]
4== Prerequisites
5
6To run the Gerrit service, the following requirement must be met on the host:
Fredrik Luthander833aa742011-10-27 21:07:46 +02007
David Ostrovsky841e3922020-01-09 01:05:05 +01008* JRE, versions 1.8 or 11 http://www.oracle.com/technetwork/java/javase/downloads/index.html[Download]
Gert van Dijka9d55112018-08-16 12:07:13 +02009+
David Ostrovsky841e3922020-01-09 01:05:05 +010010Gerrit is not yet compatible with Java 13 or newer at this time.
Fredrik Luthander833aa742011-10-27 21:07:46 +020011
Mark Derricuttde6c16d2014-03-25 13:45:05 +130012[[cryptography]]
13== Configure Java for Strong Cryptography
Janet Davies0c1a6212018-05-09 15:18:57 -070014
Mark Derricuttde6c16d2014-03-25 13:45:05 +130015Support for extra strength cryptographic ciphers: _AES128CTR_, _AES256CTR_,
16_ARCFOUR256_, and _ARCFOUR128_ can be enabled by downloading the _Java
17Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files_
18from Oracle and installing them into your JRE.
19
Michael Ochmann8129ece2016-07-08 11:25:25 +020020[NOTE]
21Installing JCE extensions is optional and export restrictions may apply.
Mark Derricuttde6c16d2014-03-25 13:45:05 +130022
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+
29The 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
43found in `README.txt`.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080044
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080045[[download]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080046== Download Gerrit
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080047
Shawn O. Pearce31af1ff2009-01-26 12:04:41 -080048Current and past binary releases of Gerrit can be obtained from
Philip Browne3aa8b12019-06-21 21:24:41 +000049the link:https://gerrit-releases.storage.googleapis.com/index.html[
David Pursehouse8d2b4a02013-10-18 11:01:28 +090050Gerrit Releases site].
Shawn O. Pearce31af1ff2009-01-26 12:04:41 -080051
Shawn O. Pearce8ddb8cb2009-09-28 12:21:28 -070052Download 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
Anthonyd3aed4c2009-09-26 13:48:10 -040054rename the downloaded file.
Shawn O. Pearceb8527ea2009-02-02 15:39:12 -080055
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080056If you would prefer to build Gerrit directly from source, review
57the notes under link:dev-readme.html[developer setup].
Shawn O. Pearce31af1ff2009-01-26 12:04:41 -080058
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080059[[init]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080060== Initialize the Site
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080061
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080062Gerrit stores configuration files, the server's SSH keys, and the
63managed Git repositories under a local directory, typically referred
Dave Borowitzada289c2018-12-18 13:24:14 -080064to as `'$site_path'`.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080065
Fredrik Luthander833aa742011-10-27 21:07:46 +020066You also have to decide where to store your server side git repositories. This
67can either be a relative path under `'$site_path'` or an absolute path
68anywhere on your server system. You have to choose a place before commencing
69your init phase.
70
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080071Initialize a new site directory by running the init command, passing
72the 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
74own user account on the host system:
75
76----
David Pursehouse64df83a2017-07-04 21:20:47 +090077 sudo adduser gerrit
78 sudo su gerrit
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080079
Fredrik Luthander833aa742011-10-27 21:07:46 +020080 java -jar gerrit.war init -d /path/to/your/gerrit_application_directory
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080081----
82
Michael Ochmann8129ece2016-07-08 11:25:25 +020083[NOTE]
84If you choose a location where your new user doesn't
Fredrik Luthander833aa742011-10-27 21:07:46 +020085have any privileges, you may have to manually create the directory first and
David Pursehouse64df83a2017-07-04 21:20:47 +090086then give ownership of that location to the `'gerrit'` user.
Fredrik Luthander833aa742011-10-27 21:07:46 +020087
88If run from an interactive terminal, the init command will prompt through a
Dave Borowitzada289c2018-12-18 13:24:14 -080089series of configuration questions. If the terminal is not interactive,
90running the init command will choose some reasonable default selections.
91Once the init phase is complete, you can review your settings in the file
92`'$site_path/etc/gerrit.config'`.
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080093
Fredrik Luthander833aa742011-10-27 21:07:46 +020094When running the init command, additional JARs might be downloaded to
95support optional selected functionality. If a download fails a URL will
96be displayed and init will wait for the user to manually download the JAR
97and store it in the target location.
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080098
Fredrik Luthander833aa742011-10-27 21:07:46 +020099When the init phase is complete, the daemon will be automatically started
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800100in the background and your web browser will open to the site:
101
102----
David Pursehouse64df83a2017-07-04 21:20:47 +0900103 Initialized /home/gerrit/review_site
104 Executing /home/gerrit/review_site/bin/gerrit.sh start
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800105 Starting Gerrit Code Review: OK
106 Waiting for server to start ... OK
107 Opening browser ...
108----
109
110When the browser opens, sign in to Gerrit through the web interface.
111The first user to sign-in and register an account will be
112automatically placed into the fully privileged Administrators group,
113permitting server management over the web and over SSH. Subsequent
114users will be automatically registered as unprivileged users.
115
116
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800117== Installation Complete
Fredrik Luthander833aa742011-10-27 21:07:46 +0200118
119Your base Gerrit server is now installed and running. You're now ready to
120either set up more projects or start working with the projects you've already
121imported.
122
123
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800124[[project_setup]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800125== Project Setup
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800126
Stefan Lay08ba4732014-05-05 16:36:12 +0200127See link:project-configuration.html[Project Configuration] for further details on
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800128how to register a new project with Gerrit. This step is necessary
129if existing Git repositories were not imported during 'init'.
130
131
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100132[[rc_d]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800133== Start/Stop Daemon
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800134
135To control the Gerrit Code Review daemon that is running in the
136background, use the rc.d style start script created by 'init':
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800137
Michael Ochmannb99feab2016-07-06 14:10:22 +0200138----
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800139 review_site/bin/gerrit.sh start
140 review_site/bin/gerrit.sh stop
141 review_site/bin/gerrit.sh restart
Michael Ochmannb99feab2016-07-06 14:10:22 +0200142----
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800143
David Pursehouse626f8b52013-10-24 13:10:56 +0900144('Optional') Configure the daemon to automatically start and stop
145with the operating system.
146
147Uncomment the following 3 lines in the `'$site_path/bin/gerrit.sh'`
148script:
149
Michael Ochmannb99feab2016-07-06 14:10:22 +0200150----
David Pursehouse626f8b52013-10-24 13:10:56 +0900151 chkconfig: 3 99 99
152 description: Gerrit Code Review
153 processname: gerrit
Michael Ochmannb99feab2016-07-06 14:10:22 +0200154----
David Pursehouse626f8b52013-10-24 13:10:56 +0900155
156Then link the `gerrit.sh` script into `rc3.d`:
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800157
Michael Ochmannb99feab2016-07-06 14:10:22 +0200158----
Kyle Laker839edfc2013-03-08 01:05:10 -0500159 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 Ochmannb99feab2016-07-06 14:10:22 +0200161----
Shawn O. Pearce86816ee2009-05-13 17:37:20 -0700162
David Pursehousebe284992013-09-26 14:43:33 +0900163('Optional') To enable autocompletion of the gerrit.sh commands, install
164autocompletion from the `/contrib/bash_completion` script. Refer to the
165script's header comments for installation instructions.
166
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800167To install Gerrit into an existing servlet container instead of using
168the embedded Jetty server, see
169link:install-j2ee.html[J2EE installation].
Shawn O. Pearce86816ee2009-05-13 17:37:20 -0700170
Rafal Klys6c454be2016-01-12 00:08:29 +0100171[[installation_on_windows]]
172== Installation on Windows
173
Gert van Dijk47b0ed32018-01-12 10:03:52 +0100174The `ssh-keygen` command must be available during the init phase to
175generate SSH host keys. If you have
Rafal Klys6c454be2016-01-12 00:08:29 +0100176link:https://git-for-windows.github.io/[Git for Windows] installed,
177start Command Prompt and temporary add directory with ssh-keygen to the
178PATH environment variable just before running init command:
179
180====
181 PATH=%PATH%;c:\Program Files\Git\usr\bin
182====
183
184Please note that the path in the above example must not be
185double-quoted.
186
187To 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
194To stop the daemon press Ctrl+C.
195
196=== Install the daemon as Windows Service
197
198To install Gerrit as Windows Service use the
199link:http://commons.apache.org/proper/commons-daemon/procrun.html[Apache
200Commons Daemon Procrun].
201
202Sample 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 Kempin64a87762018-12-10 13:38:21 +0100212 --StopClass=com.google.gerrit.launcher.GerritLauncher --StopMethod=daemonStop
Rafal Klys6c454be2016-01-12 00:08:29 +0100213====
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800214
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800215[[customize]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800216== Site Customization
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800217
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800218Gerrit Code Review supports some site-specific customization options.
David Pursehouse221d4f62012-06-08 17:38:08 +0900219For more information, see the related topics in this manual:
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800220
Francois Marierd550b462011-04-13 14:30:20 +1200221* link:config-reverseproxy.html[Reverse Proxy]
Shawn O. Pearcef384b442009-01-10 16:20:56 -0800222* link:config-sso.html[Single Sign-On Systems]
Dave Borowitz1e49e142013-04-09 12:14:57 -0700223* link:config-themes.html[Themes]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800224* link:config-gitweb.html[Gitweb Integration]
Shawn O. Pearce7b405712009-05-08 18:27:53 -0700225* link:config-gerrit.html[Other System Settings]
Sasa Zivkove5fc90e2013-05-10 15:12:13 +0200226* link:config-auto-site-initialization.html[Automatic Site Initialization on Startup]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800227
Shawn O. Pearce0b91a632009-02-06 12:53:59 -0800228
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800229[[anonymous_access]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800230== Anonymous Access
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800231
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800232Exporting the Git repository directory
233(link:config-gerrit.html#gerrit.basePath[gerrit.basePath]) over the
234anonymous, unencrypted git:// protocol is more efficient than
235Gerrit's internal SSH daemon. See the `git-daemon` documentation
236for details on how to configure this if anonymous access is desired.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800237
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800238* http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[man git-daemon]
Shawn O. Pearceb546c9b2009-02-24 13:12:39 -0800239
240
Martin Fick472bb9d2012-05-08 16:30:16 -0700241[[plugins]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800242== Plugins
Martin Fick472bb9d2012-05-08 16:30:16 -0700243
244Place Gerrit plugins in the review_site/plugins directory to have them loaded on Gerrit startup.
245
246
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800247== External Documentation Links
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800248
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800249* http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[git-daemon]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800250
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700251
Matthias Sohn0d213562019-11-29 02:01:56 +0100252[[backup]]
253== Backup
254
255See the link:backup.html[backup documentation].
256
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700257GERRIT
258------
259Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700260
261SEARCHBOX
262---------