2019-12-13 10:42:46 +01:00
|
|
|
:linkattrs:
|
2013-12-20 12:55:51 -08:00
|
|
|
= Gerrit Code Review - Standalone Daemon Installation Guide
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2018-05-09 15:18:57 -07:00
|
|
|
[[prerequisites]]
|
|
|
|
== Prerequisites
|
|
|
|
|
|
|
|
To run the Gerrit service, the following requirement must be met on the host:
|
2011-10-27 21:07:46 +02:00
|
|
|
|
2020-01-10 14:20:23 +09:00
|
|
|
* JRE, versions 1.8 or 11 http://www.oracle.com/technetwork/java/javase/downloads/index.html[Download,role=external,window=_blank]
|
2018-08-16 12:07:13 +02:00
|
|
|
+
|
2020-01-09 01:05:05 +01:00
|
|
|
Gerrit is not yet compatible with Java 13 or newer at this time.
|
2011-10-27 21:07:46 +02:00
|
|
|
|
2014-03-25 13:45:05 +13:00
|
|
|
[[cryptography]]
|
|
|
|
== Configure Java for Strong Cryptography
|
2018-05-09 15:18:57 -07:00
|
|
|
|
2014-03-25 13:45:05 +13:00
|
|
|
Support for extra strength cryptographic ciphers: _AES128CTR_, _AES256CTR_,
|
|
|
|
_ARCFOUR256_, and _ARCFOUR128_ can be enabled by downloading the _Java
|
|
|
|
Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files_
|
|
|
|
from Oracle and installing them into your JRE.
|
|
|
|
|
2016-07-08 11:25:25 +02:00
|
|
|
[NOTE]
|
|
|
|
Installing JCE extensions is optional and export restrictions may apply.
|
2014-03-25 13:45:05 +13:00
|
|
|
|
|
|
|
. Download the unlimited strength JCE policy files.
|
|
|
|
+
|
2019-12-10 18:01:31 +01:00
|
|
|
- link:http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html[JDK7 JCE policy files,role=external,window=_blank]
|
|
|
|
- link:http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html[JDK8 JCE policy files,role=external,window=_blank]
|
2014-03-25 13:45:05 +13:00
|
|
|
. Uncompress and extract the downloaded file.
|
|
|
|
+
|
|
|
|
The downloaded file contains the following files:
|
|
|
|
+
|
|
|
|
[cols="2"]
|
|
|
|
|===
|
|
|
|
|README.txt
|
|
|
|
|Information about JCE and installation guide
|
|
|
|
|
|
|
|
|local_policy.jar
|
|
|
|
|Unlimited strength local policy file
|
|
|
|
|
|
|
|
|US_export_policy.jar
|
|
|
|
|Unlimited strength US export policy file
|
|
|
|
|===
|
|
|
|
. Install the unlimited strength policy JAR files by following instructions
|
|
|
|
found in `README.txt`.
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2009-12-11 19:06:21 -08:00
|
|
|
[[download]]
|
2013-12-20 12:55:51 -08:00
|
|
|
== Download Gerrit
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2009-01-26 12:04:41 -08:00
|
|
|
Current and past binary releases of Gerrit can be obtained from
|
2019-06-21 21:24:41 +00:00
|
|
|
the link:https://gerrit-releases.storage.googleapis.com/index.html[
|
2019-12-10 18:01:31 +01:00
|
|
|
Gerrit Releases site,role=external,window=_blank].
|
2009-01-26 12:04:41 -08:00
|
|
|
|
2009-09-28 12:21:28 -07:00
|
|
|
Download any current `*.war` package. The war will be referred to as
|
|
|
|
`gerrit.war` from this point forward, so you may find it easier to
|
2009-09-26 13:48:10 -04:00
|
|
|
rename the downloaded file.
|
2009-02-02 15:39:12 -08:00
|
|
|
|
2009-12-11 19:06:21 -08:00
|
|
|
If you would prefer to build Gerrit directly from source, review
|
|
|
|
the notes under link:dev-readme.html[developer setup].
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2009-12-11 19:06:21 -08:00
|
|
|
[[init]]
|
2013-12-20 12:55:51 -08:00
|
|
|
== Initialize the Site
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2009-12-11 19:06:21 -08:00
|
|
|
Gerrit stores configuration files, the server's SSH keys, and the
|
|
|
|
managed Git repositories under a local directory, typically referred
|
2018-12-18 13:24:14 -08:00
|
|
|
to as `'$site_path'`.
|
2009-12-11 19:06:21 -08:00
|
|
|
|
2011-10-27 21:07:46 +02:00
|
|
|
You also have to decide where to store your server side git repositories. This
|
|
|
|
can either be a relative path under `'$site_path'` or an absolute path
|
|
|
|
anywhere on your server system. You have to choose a place before commencing
|
|
|
|
your init phase.
|
|
|
|
|
2009-12-11 19:06:21 -08:00
|
|
|
Initialize a new site directory by running the init command, passing
|
|
|
|
the path of the site directory to be created as an argument to the
|
|
|
|
'-d' option. Its recommended that Gerrit Code Review be given its
|
|
|
|
own user account on the host system:
|
|
|
|
|
|
|
|
----
|
2017-07-04 21:20:47 +09:00
|
|
|
sudo adduser gerrit
|
|
|
|
sudo su gerrit
|
2009-12-11 19:06:21 -08:00
|
|
|
|
2011-10-27 21:07:46 +02:00
|
|
|
java -jar gerrit.war init -d /path/to/your/gerrit_application_directory
|
2009-12-11 19:06:21 -08:00
|
|
|
----
|
|
|
|
|
2016-07-08 11:25:25 +02:00
|
|
|
[NOTE]
|
|
|
|
If you choose a location where your new user doesn't
|
2011-10-27 21:07:46 +02:00
|
|
|
have any privileges, you may have to manually create the directory first and
|
2017-07-04 21:20:47 +09:00
|
|
|
then give ownership of that location to the `'gerrit'` user.
|
2011-10-27 21:07:46 +02:00
|
|
|
|
|
|
|
If run from an interactive terminal, the init command will prompt through a
|
2018-12-18 13:24:14 -08:00
|
|
|
series of configuration questions. If the terminal is not interactive,
|
|
|
|
running the init command will choose some reasonable default selections.
|
|
|
|
Once the init phase is complete, you can review your settings in the file
|
|
|
|
`'$site_path/etc/gerrit.config'`.
|
2009-12-11 19:06:21 -08:00
|
|
|
|
2011-10-27 21:07:46 +02:00
|
|
|
When running the init command, additional JARs might be downloaded to
|
|
|
|
support optional selected functionality. If a download fails a URL will
|
|
|
|
be displayed and init will wait for the user to manually download the JAR
|
|
|
|
and store it in the target location.
|
2009-12-11 19:06:21 -08:00
|
|
|
|
2011-10-27 21:07:46 +02:00
|
|
|
When the init phase is complete, the daemon will be automatically started
|
2009-12-11 19:06:21 -08:00
|
|
|
in the background and your web browser will open to the site:
|
|
|
|
|
|
|
|
----
|
2017-07-04 21:20:47 +09:00
|
|
|
Initialized /home/gerrit/review_site
|
|
|
|
Executing /home/gerrit/review_site/bin/gerrit.sh start
|
2009-12-11 19:06:21 -08:00
|
|
|
Starting Gerrit Code Review: OK
|
|
|
|
Waiting for server to start ... OK
|
|
|
|
Opening browser ...
|
|
|
|
----
|
|
|
|
|
|
|
|
When the browser opens, sign in to Gerrit through the web interface.
|
|
|
|
The first user to sign-in and register an account will be
|
|
|
|
automatically placed into the fully privileged Administrators group,
|
|
|
|
permitting server management over the web and over SSH. Subsequent
|
|
|
|
users will be automatically registered as unprivileged users.
|
|
|
|
|
|
|
|
|
2013-12-20 12:55:51 -08:00
|
|
|
== Installation Complete
|
2011-10-27 21:07:46 +02:00
|
|
|
|
|
|
|
Your base Gerrit server is now installed and running. You're now ready to
|
|
|
|
either set up more projects or start working with the projects you've already
|
|
|
|
imported.
|
|
|
|
|
|
|
|
|
2009-12-11 19:06:21 -08:00
|
|
|
[[project_setup]]
|
2013-12-20 12:55:51 -08:00
|
|
|
== Project Setup
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2014-05-05 16:36:12 +02:00
|
|
|
See link:project-configuration.html[Project Configuration] for further details on
|
2009-12-11 19:06:21 -08:00
|
|
|
how to register a new project with Gerrit. This step is necessary
|
|
|
|
if existing Git repositories were not imported during 'init'.
|
2009-02-06 13:49:43 -08:00
|
|
|
|
2009-09-26 13:48:10 -04:00
|
|
|
|
2011-03-25 14:21:59 +01:00
|
|
|
[[rc_d]]
|
2013-12-20 12:55:51 -08:00
|
|
|
== Start/Stop Daemon
|
2009-02-06 13:49:43 -08:00
|
|
|
|
2009-12-11 19:06:21 -08:00
|
|
|
To control the Gerrit Code Review daemon that is running in the
|
|
|
|
background, use the rc.d style start script created by 'init':
|
2009-05-30 12:07:11 -07:00
|
|
|
|
2016-07-06 14:10:22 +02:00
|
|
|
----
|
2009-12-11 19:06:21 -08:00
|
|
|
review_site/bin/gerrit.sh start
|
|
|
|
review_site/bin/gerrit.sh stop
|
|
|
|
review_site/bin/gerrit.sh restart
|
2016-07-06 14:10:22 +02:00
|
|
|
----
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2013-10-24 13:10:56 +09:00
|
|
|
('Optional') Configure the daemon to automatically start and stop
|
|
|
|
with the operating system.
|
|
|
|
|
|
|
|
Uncomment the following 3 lines in the `'$site_path/bin/gerrit.sh'`
|
|
|
|
script:
|
|
|
|
|
2016-07-06 14:10:22 +02:00
|
|
|
----
|
2013-10-24 13:10:56 +09:00
|
|
|
chkconfig: 3 99 99
|
|
|
|
description: Gerrit Code Review
|
|
|
|
processname: gerrit
|
2016-07-06 14:10:22 +02:00
|
|
|
----
|
2013-10-24 13:10:56 +09:00
|
|
|
|
|
|
|
Then link the `gerrit.sh` script into `rc3.d`:
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2016-07-06 14:10:22 +02:00
|
|
|
----
|
2013-03-08 01:05:10 -05:00
|
|
|
sudo ln -snf `pwd`/review_site/bin/gerrit.sh /etc/init.d/gerrit
|
|
|
|
sudo ln -snf /etc/init.d/gerrit /etc/rc3.d/S90gerrit
|
2016-07-06 14:10:22 +02:00
|
|
|
----
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2013-09-26 14:43:33 +09:00
|
|
|
('Optional') To enable autocompletion of the gerrit.sh commands, install
|
|
|
|
autocompletion from the `/contrib/bash_completion` script. Refer to the
|
|
|
|
script's header comments for installation instructions.
|
|
|
|
|
2009-12-11 19:06:21 -08:00
|
|
|
To install Gerrit into an existing servlet container instead of using
|
|
|
|
the embedded Jetty server, see
|
|
|
|
link:install-j2ee.html[J2EE installation].
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2016-01-12 00:08:29 +01:00
|
|
|
[[installation_on_windows]]
|
|
|
|
== Installation on Windows
|
|
|
|
|
2018-01-12 10:03:52 +01:00
|
|
|
The `ssh-keygen` command must be available during the init phase to
|
|
|
|
generate SSH host keys. If you have
|
2019-12-10 18:01:31 +01:00
|
|
|
link:https://git-for-windows.github.io/[Git for Windows,role=external,window=_blank] installed,
|
2016-01-12 00:08:29 +01:00
|
|
|
start Command Prompt and temporary add directory with ssh-keygen to the
|
|
|
|
PATH environment variable just before running init command:
|
|
|
|
|
|
|
|
====
|
|
|
|
PATH=%PATH%;c:\Program Files\Git\usr\bin
|
|
|
|
====
|
|
|
|
|
|
|
|
Please note that the path in the above example must not be
|
|
|
|
double-quoted.
|
|
|
|
|
|
|
|
To run the daemon after site initialization execute:
|
|
|
|
|
|
|
|
====
|
|
|
|
cd C:\MY\GERRIT\SITE
|
|
|
|
java.exe -jar bin\gerrit.war daemon --console-log
|
|
|
|
====
|
|
|
|
|
|
|
|
To stop the daemon press Ctrl+C.
|
|
|
|
|
|
|
|
=== Install the daemon as Windows Service
|
|
|
|
|
|
|
|
To install Gerrit as Windows Service use the
|
|
|
|
link:http://commons.apache.org/proper/commons-daemon/procrun.html[Apache
|
2019-12-10 18:01:31 +01:00
|
|
|
Commons Daemon Procrun,role=external,window=_blank].
|
2016-01-12 00:08:29 +01:00
|
|
|
|
|
|
|
Sample install command:
|
|
|
|
|
|
|
|
====
|
|
|
|
prunsrv.exe //IS//Gerrit --DisplayName="Gerrit Code Review" --Startup=auto ^
|
|
|
|
--Jvm="C:\Program Files\Java\jre1.8.0_65\bin\server\jvm.dll" ^
|
|
|
|
--Classpath=C:\MY\GERRIT\SITE\bin\gerrit.war ^
|
|
|
|
--LogPath=C:\MY\GERRIT\SITE\logs ^
|
|
|
|
--StartPath=C:\MY\GERRIT\SITE ^
|
|
|
|
--StartMode=jvm --StopMode=jvm ^
|
|
|
|
--StartClass=com.google.gerrit.launcher.GerritLauncher --StartMethod=daemonStart ^
|
2018-12-10 13:38:21 +01:00
|
|
|
--StopClass=com.google.gerrit.launcher.GerritLauncher --StopMethod=daemonStop
|
2016-01-12 00:08:29 +01:00
|
|
|
====
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2009-12-11 19:06:21 -08:00
|
|
|
[[customize]]
|
2013-12-20 12:55:51 -08:00
|
|
|
== Site Customization
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2009-12-11 19:06:21 -08:00
|
|
|
Gerrit Code Review supports some site-specific customization options.
|
2012-06-08 17:38:08 +09:00
|
|
|
For more information, see the related topics in this manual:
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2011-04-13 14:30:20 +12:00
|
|
|
* link:config-reverseproxy.html[Reverse Proxy]
|
2009-01-10 16:20:56 -08:00
|
|
|
* link:config-sso.html[Single Sign-On Systems]
|
2013-04-09 12:14:57 -07:00
|
|
|
* link:config-themes.html[Themes]
|
2009-01-09 11:55:47 -08:00
|
|
|
* link:config-gitweb.html[Gitweb Integration]
|
2009-05-08 18:27:53 -07:00
|
|
|
* link:config-gerrit.html[Other System Settings]
|
Optionally, initialize site from WebAppInitializer.
This supports automatic site initialization on Gerrit server startup
when Gerrit runs in a servlet container. Both creation of a new site
and upgrade of an existing site are supported.
This feature may be useful for such setups where Gerrit admins don't
have direct access to the database and the file system of the server
where Gerrit should be deployed and, therefore, cannot perform the
init from their local machine prior to deploying Gerrit on such a
server. It may also make deployment and testing in a local servlet
container faster to setup as the init step could be skipped.
The site initialization will be performed only if the 'gerrit.init'
system property exists (the value of the property is not, used only the
existence of the property matters).
If the 'gerrit.site_path' system property is defined then the init is
run for that site. The database connectivity, in that case, is defined
in the etc/gerrit.config.
If 'gerrit.site_path' is not defined then Gerrit will try to find an
existing site by looking into the system_config table in the database
defined via the 'jdbc/ReviewDb' JNDI property. If system_config table
exists then the site_path from that table is used for initialization.
Database connectivity is defined by the jdbc/ReviewDb JNDI property.
Finally, if neither 'gerrit.site_path' property nor the system_config
table exists, the 'gerrit.init_path' system property, if defined, will
be used to determine the site path. Database connectivity, also for this
case,is defined by the jdbc/ReviewDb JNDI property.
Example 1:
Prepare Tomcat so that a site is initialized at a given path using
the H2 database (if the site doesn't exist yet) or using whatever
database is defined in the etc/gerrit.config of that site:
$ export CATALINA_OPTS='-Dgerrit.init -Dgerrit.site_path=/path/to/site'
$ catalina.sh start
Example 2:
Prepare Tomcat so that an existing site with the path defined in the
system_config table is initialized (upgraded) on Gerrit startup. The
assumption is that the jdbc/ReviewDb JNDI property is defined in
Tomcat:
$ export CATALINA_OPTS='-Dgerrit.init'
$ catalina.sh start
Example 3:
Assuming the database schema doesn't exist in the database defined
via the jdbc/ReviewDb JNDI property, initialize a new site using that
database and a given path:
$ export CATALINA_OPTS='-Dgerrit.init -Dgerrit.init_path=/path/to/site'
$ catalina.sh start
Change-Id: Ic3e8c993087d2fbb38e14479a539dc62495ad908
2013-05-10 15:12:13 +02:00
|
|
|
* link:config-auto-site-initialization.html[Automatic Site Initialization on Startup]
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2009-02-06 12:53:59 -08:00
|
|
|
|
2009-12-11 19:06:21 -08:00
|
|
|
[[anonymous_access]]
|
2013-12-20 12:55:51 -08:00
|
|
|
== Anonymous Access
|
2009-02-24 13:12:39 -08:00
|
|
|
|
2009-12-11 19:06:21 -08:00
|
|
|
Exporting the Git repository directory
|
|
|
|
(link:config-gerrit.html#gerrit.basePath[gerrit.basePath]) over the
|
|
|
|
anonymous, unencrypted git:// protocol is more efficient than
|
|
|
|
Gerrit's internal SSH daemon. See the `git-daemon` documentation
|
|
|
|
for details on how to configure this if anonymous access is desired.
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2019-12-10 18:01:31 +01:00
|
|
|
* http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[man git-daemon,role=external,window=_blank]
|
2009-01-09 11:55:47 -08:00
|
|
|
|
|
|
|
|
2012-05-08 16:30:16 -07:00
|
|
|
[[plugins]]
|
2013-12-20 12:55:51 -08:00
|
|
|
== Plugins
|
2012-05-08 16:30:16 -07:00
|
|
|
|
|
|
|
Place Gerrit plugins in the review_site/plugins directory to have them loaded on Gerrit startup.
|
|
|
|
|
|
|
|
|
2013-12-20 12:55:51 -08:00
|
|
|
== External Documentation Links
|
2009-01-09 11:55:47 -08:00
|
|
|
|
2019-12-10 18:01:31 +01:00
|
|
|
* http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[git-daemon,role=external,window=_blank]
|
2009-02-06 12:53:59 -08:00
|
|
|
|
2009-05-28 15:55:01 -07:00
|
|
|
|
2019-11-29 02:01:56 +01:00
|
|
|
[[backup]]
|
|
|
|
== Backup
|
|
|
|
|
|
|
|
See the link:backup.html[backup documentation].
|
|
|
|
|
2009-05-28 15:55:01 -07:00
|
|
|
GERRIT
|
|
|
|
------
|
|
|
|
Part of link:index.html[Gerrit Code Review]
|
2013-10-31 17:26:00 -07:00
|
|
|
|
|
|
|
SEARCHBOX
|
|
|
|
---------
|