blob: 87d757e550139a69e08e31b51e61f1c104ebcd37 [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
Fredrik Luthander833aa742011-10-27 21:07:46 +02003[[requirements]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004== Requirements
Fredrik Luthander833aa742011-10-27 21:07:46 +02005To run the Gerrit service, the following requirements must be met on
6the host:
7
Gert van Dijka9d55112018-08-16 12:07:13 +02008* JRE, version 1.8 http://www.oracle.com/technetwork/java/javase/downloads/index.html[Download]
9+
10Gerrit is not yet compatible with Java 9 or newer at this time.
Fredrik Luthander833aa742011-10-27 21:07:46 +020011
David Pursehouse3be717b2013-05-13 13:56:11 +090012You'll also need an SQL database to house the review metadata. You have the
Fredrik Luthander833aa742011-10-27 21:07:46 +020013choice of either using the embedded H2 or to host your own MySQL or PostgreSQL.
14
Mark Derricuttde6c16d2014-03-25 13:45:05 +130015[[cryptography]]
16== Configure Java for Strong Cryptography
17Support for extra strength cryptographic ciphers: _AES128CTR_, _AES256CTR_,
18_ARCFOUR256_, and _ARCFOUR128_ can be enabled by downloading the _Java
19Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files_
20from Oracle and installing them into your JRE.
21
Michael Ochmann8129ece2016-07-08 11:25:25 +020022[NOTE]
23Installing JCE extensions is optional and export restrictions may apply.
Mark Derricuttde6c16d2014-03-25 13:45:05 +130024
25. Download the unlimited strength JCE policy files.
26+
27- link:http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html[JDK7 JCE policy files]
28- link:http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html[JDK8 JCE policy files]
29. Uncompress and extract the downloaded file.
30+
31The downloaded file contains the following files:
32+
33[cols="2"]
34|===
35|README.txt
36|Information about JCE and installation guide
37
38|local_policy.jar
39|Unlimited strength local policy file
40
41|US_export_policy.jar
42|Unlimited strength US export policy file
43|===
44. Install the unlimited strength policy JAR files by following instructions
45found in `README.txt`.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080046
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080047[[download]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080048== Download Gerrit
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080049
Shawn O. Pearce31af1ff2009-01-26 12:04:41 -080050Current and past binary releases of Gerrit can be obtained from
Shawn Pearce6d7ebc62015-06-12 16:34:42 -070051the link:https://www.gerritcodereview.com/download/index.html[
David Pursehouse8d2b4a02013-10-18 11:01:28 +090052Gerrit Releases site].
Shawn O. Pearce31af1ff2009-01-26 12:04:41 -080053
Shawn O. Pearce8ddb8cb2009-09-28 12:21:28 -070054Download any current `*.war` package. The war will be referred to as
55`gerrit.war` from this point forward, so you may find it easier to
Anthonyd3aed4c2009-09-26 13:48:10 -040056rename the downloaded file.
Shawn O. Pearceb8527ea2009-02-02 15:39:12 -080057
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080058If you would prefer to build Gerrit directly from source, review
59the notes under link:dev-readme.html[developer setup].
Shawn O. Pearce31af1ff2009-01-26 12:04:41 -080060
Jason Huntley25bbd512012-08-02 11:10:31 -040061include::database-setup.txt[]
Shawn O. Pearce0b91a632009-02-06 12:53:59 -080062
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080063[[init]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080064== Initialize the Site
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080065
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080066Gerrit stores configuration files, the server's SSH keys, and the
67managed Git repositories under a local directory, typically referred
68to as `'$site_path'`. If the embedded H2 database is being used,
69its data files will also be stored under this directory.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080070
Fredrik Luthander833aa742011-10-27 21:07:46 +020071You also have to decide where to store your server side git repositories. This
72can either be a relative path under `'$site_path'` or an absolute path
73anywhere on your server system. You have to choose a place before commencing
74your init phase.
75
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080076Initialize a new site directory by running the init command, passing
77the path of the site directory to be created as an argument to the
78'-d' option. Its recommended that Gerrit Code Review be given its
79own user account on the host system:
80
81----
82 sudo adduser gerrit2
83 sudo su gerrit2
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080084
Fredrik Luthander833aa742011-10-27 21:07:46 +020085 java -jar gerrit.war init -d /path/to/your/gerrit_application_directory
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080086----
87
Michael Ochmann8129ece2016-07-08 11:25:25 +020088[NOTE]
89If you choose a location where your new user doesn't
Fredrik Luthander833aa742011-10-27 21:07:46 +020090have any privileges, you may have to manually create the directory first and
91then give ownership of that location to the `'gerrit2'` user.
92
93If run from an interactive terminal, the init command will prompt through a
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080094series of configuration questions, including gathering information
Fredrik Luthander833aa742011-10-27 21:07:46 +020095about the database created above. If the terminal is not interactive,
96running the init command will choose some reasonable default selections,
97and will use the embedded H2 database. Once the init phase is complete,
98you can review your settings in the file `'$site_path/etc/gerrit.config'`.
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080099
Fredrik Luthander833aa742011-10-27 21:07:46 +0200100When running the init command, additional JARs might be downloaded to
101support optional selected functionality. If a download fails a URL will
102be displayed and init will wait for the user to manually download the JAR
103and store it in the target location.
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800104
Fredrik Luthander833aa742011-10-27 21:07:46 +0200105When the init phase is complete, the daemon will be automatically started
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800106in the background and your web browser will open to the site:
107
108----
109 Initialized /home/gerrit2/review_site
110 Executing /home/gerrit2/review_site/bin/gerrit.sh start
111 Starting Gerrit Code Review: OK
112 Waiting for server to start ... OK
113 Opening browser ...
114----
115
116When the browser opens, sign in to Gerrit through the web interface.
117The first user to sign-in and register an account will be
118automatically placed into the fully privileged Administrators group,
119permitting server management over the web and over SSH. Subsequent
120users will be automatically registered as unprivileged users.
121
122
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800123== Installation Complete
Fredrik Luthander833aa742011-10-27 21:07:46 +0200124
125Your base Gerrit server is now installed and running. You're now ready to
126either set up more projects or start working with the projects you've already
127imported.
128
129
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800130[[project_setup]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800131== Project Setup
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800132
Stefan Lay08ba4732014-05-05 16:36:12 +0200133See link:project-configuration.html[Project Configuration] for further details on
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800134how to register a new project with Gerrit. This step is necessary
135if existing Git repositories were not imported during 'init'.
136
137
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100138[[rc_d]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800139== Start/Stop Daemon
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800140
141To control the Gerrit Code Review daemon that is running in the
142background, use the rc.d style start script created by 'init':
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800143
Michael Ochmannb99feab2016-07-06 14:10:22 +0200144----
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800145 review_site/bin/gerrit.sh start
146 review_site/bin/gerrit.sh stop
147 review_site/bin/gerrit.sh restart
Michael Ochmannb99feab2016-07-06 14:10:22 +0200148----
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800149
David Pursehouse626f8b52013-10-24 13:10:56 +0900150('Optional') Configure the daemon to automatically start and stop
151with the operating system.
152
153Uncomment the following 3 lines in the `'$site_path/bin/gerrit.sh'`
154script:
155
Michael Ochmannb99feab2016-07-06 14:10:22 +0200156----
David Pursehouse626f8b52013-10-24 13:10:56 +0900157 chkconfig: 3 99 99
158 description: Gerrit Code Review
159 processname: gerrit
Michael Ochmannb99feab2016-07-06 14:10:22 +0200160----
David Pursehouse626f8b52013-10-24 13:10:56 +0900161
162Then link the `gerrit.sh` script into `rc3.d`:
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800163
Michael Ochmannb99feab2016-07-06 14:10:22 +0200164----
Kyle Laker839edfc2013-03-08 01:05:10 -0500165 sudo ln -snf `pwd`/review_site/bin/gerrit.sh /etc/init.d/gerrit
166 sudo ln -snf /etc/init.d/gerrit /etc/rc3.d/S90gerrit
Michael Ochmannb99feab2016-07-06 14:10:22 +0200167----
Shawn O. Pearce86816ee2009-05-13 17:37:20 -0700168
David Pursehousebe284992013-09-26 14:43:33 +0900169('Optional') To enable autocompletion of the gerrit.sh commands, install
170autocompletion from the `/contrib/bash_completion` script. Refer to the
171script's header comments for installation instructions.
172
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800173To install Gerrit into an existing servlet container instead of using
174the embedded Jetty server, see
175link:install-j2ee.html[J2EE installation].
Shawn O. Pearce86816ee2009-05-13 17:37:20 -0700176
Rafal Klys6c454be2016-01-12 00:08:29 +0100177[[installation_on_windows]]
178== Installation on Windows
179
Gert van Dijk47b0ed32018-01-12 10:03:52 +0100180The `ssh-keygen` command must be available during the init phase to
181generate SSH host keys. If you have
Rafal Klys6c454be2016-01-12 00:08:29 +0100182link:https://git-for-windows.github.io/[Git for Windows] installed,
183start Command Prompt and temporary add directory with ssh-keygen to the
184PATH environment variable just before running init command:
185
186====
187 PATH=%PATH%;c:\Program Files\Git\usr\bin
188====
189
190Please note that the path in the above example must not be
191double-quoted.
192
193To run the daemon after site initialization execute:
194
195====
196 cd C:\MY\GERRIT\SITE
197 java.exe -jar bin\gerrit.war daemon --console-log
198====
199
200To stop the daemon press Ctrl+C.
201
202=== Install the daemon as Windows Service
203
204To install Gerrit as Windows Service use the
205link:http://commons.apache.org/proper/commons-daemon/procrun.html[Apache
206Commons Daemon Procrun].
207
208Sample install command:
209
210====
211 prunsrv.exe //IS//Gerrit --DisplayName="Gerrit Code Review" --Startup=auto ^
212 --Jvm="C:\Program Files\Java\jre1.8.0_65\bin\server\jvm.dll" ^
213 --Classpath=C:\MY\GERRIT\SITE\bin\gerrit.war ^
214 --LogPath=C:\MY\GERRIT\SITE\logs ^
215 --StartPath=C:\MY\GERRIT\SITE ^
216 --StartMode=jvm --StopMode=jvm ^
217 --StartClass=com.google.gerrit.launcher.GerritLauncher --StartMethod=daemonStart ^
218 --StopClass=com.google.gerrit.launcher.GerritLauncher --StopMethod=daemonStop ^
219 ++DependsOn=postgresql-x64-9.4
220====
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800221
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800222[[customize]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800223== Site Customization
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800224
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800225Gerrit Code Review supports some site-specific customization options.
David Pursehouse221d4f62012-06-08 17:38:08 +0900226For more information, see the related topics in this manual:
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800227
Francois Marierd550b462011-04-13 14:30:20 +1200228* link:config-reverseproxy.html[Reverse Proxy]
Shawn O. Pearcef384b442009-01-10 16:20:56 -0800229* link:config-sso.html[Single Sign-On Systems]
Dave Borowitz1e49e142013-04-09 12:14:57 -0700230* link:config-themes.html[Themes]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800231* link:config-gitweb.html[Gitweb Integration]
Shawn O. Pearce7b405712009-05-08 18:27:53 -0700232* link:config-gerrit.html[Other System Settings]
Sasa Zivkove5fc90e2013-05-10 15:12:13 +0200233* link:config-auto-site-initialization.html[Automatic Site Initialization on Startup]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800234
Shawn O. Pearce0b91a632009-02-06 12:53:59 -0800235
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800236[[anonymous_access]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800237== Anonymous Access
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800238
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800239Exporting the Git repository directory
240(link:config-gerrit.html#gerrit.basePath[gerrit.basePath]) over the
241anonymous, unencrypted git:// protocol is more efficient than
242Gerrit's internal SSH daemon. See the `git-daemon` documentation
243for details on how to configure this if anonymous access is desired.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800244
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800245* http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[man git-daemon]
Shawn O. Pearceb546c9b2009-02-24 13:12:39 -0800246
247
Martin Fick472bb9d2012-05-08 16:30:16 -0700248[[plugins]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800249== Plugins
Martin Fick472bb9d2012-05-08 16:30:16 -0700250
251Place Gerrit plugins in the review_site/plugins directory to have them loaded on Gerrit startup.
252
253
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800254== External Documentation Links
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800255
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800256* http://www.postgresql.org/docs/[PostgreSQL Documentation]
257* http://dev.mysql.com/doc/[MySQL Documentation]
258* http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[git-daemon]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800259
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700260
261GERRIT
262------
263Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700264
265SEARCHBOX
266---------