blob: df2f0ddc6127762538654256c93b57f2c5628305 [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
David Pursehouse0c4bde42013-12-10 14:12:56 +09008* JDK, minimum version 1.7 http://www.oracle.com/technetwork/java/javase/downloads/index.html[Download]
Fredrik Luthander833aa742011-10-27 21:07:46 +02009
David Pursehouse3be717b2013-05-13 13:56:11 +090010You'll also need an SQL database to house the review metadata. You have the
Fredrik Luthander833aa742011-10-27 21:07:46 +020011choice of either using the embedded H2 or to host your own MySQL or PostgreSQL.
12
Mark Derricuttde6c16d2014-03-25 13:45:05 +130013[[cryptography]]
14== Configure Java for Strong Cryptography
15Support 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
20NOTE: Installing JCE extensions is optional and export restrictions may apply.
21
22. Download the unlimited strength JCE policy files.
23+
24- link:http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html[JDK7 JCE policy files]
25- link:http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html[JDK8 JCE policy files]
26. Uncompress and extract the downloaded file.
27+
28The downloaded file contains the following files:
29+
30[cols="2"]
31|===
32|README.txt
33|Information about JCE and installation guide
34
35|local_policy.jar
36|Unlimited strength local policy file
37
38|US_export_policy.jar
39|Unlimited strength US export policy file
40|===
41. Install the unlimited strength policy JAR files by following instructions
42found in `README.txt`.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080043
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080044[[download]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080045== Download Gerrit
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080046
Shawn O. Pearce31af1ff2009-01-26 12:04:41 -080047Current and past binary releases of Gerrit can be obtained from
David Pursehouse8d2b4a02013-10-18 11:01:28 +090048the link:https://gerrit-releases.storage.googleapis.com/index.html[
49Gerrit Releases site].
Shawn O. Pearce31af1ff2009-01-26 12:04:41 -080050
Shawn O. Pearce8ddb8cb2009-09-28 12:21:28 -070051Download any current `*.war` package. The war will be referred to as
52`gerrit.war` from this point forward, so you may find it easier to
Anthonyd3aed4c2009-09-26 13:48:10 -040053rename the downloaded file.
Shawn O. Pearceb8527ea2009-02-02 15:39:12 -080054
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080055If you would prefer to build Gerrit directly from source, review
56the notes under link:dev-readme.html[developer setup].
Shawn O. Pearce31af1ff2009-01-26 12:04:41 -080057
Jason Huntley25bbd512012-08-02 11:10:31 -040058include::database-setup.txt[]
Shawn O. Pearce0b91a632009-02-06 12:53:59 -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
65to as `'$site_path'`. If the embedded H2 database is being used,
66its data files will also be stored under this directory.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080067
Fredrik Luthander833aa742011-10-27 21:07:46 +020068You also have to decide where to store your server side git repositories. This
69can either be a relative path under `'$site_path'` or an absolute path
70anywhere on your server system. You have to choose a place before commencing
71your init phase.
72
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080073Initialize a new site directory by running the init command, passing
74the path of the site directory to be created as an argument to the
75'-d' option. Its recommended that Gerrit Code Review be given its
76own user account on the host system:
77
78----
79 sudo adduser gerrit2
80 sudo su gerrit2
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080081
Fredrik Luthander833aa742011-10-27 21:07:46 +020082 java -jar gerrit.war init -d /path/to/your/gerrit_application_directory
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080083----
84
Fredrik Luthander833aa742011-10-27 21:07:46 +020085'Please note:' If you choose a location where your new user doesn't
86have any privileges, you may have to manually create the directory first and
87then give ownership of that location to the `'gerrit2'` user.
88
89If run from an interactive terminal, the init command will prompt through a
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080090series of configuration questions, including gathering information
Fredrik Luthander833aa742011-10-27 21:07:46 +020091about the database created above. If the terminal is not interactive,
92running the init command will choose some reasonable default selections,
93and will use the embedded H2 database. Once the init phase is complete,
94you can review your settings in the file `'$site_path/etc/gerrit.config'`.
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080095
Fredrik Luthander833aa742011-10-27 21:07:46 +020096When running the init command, additional JARs might be downloaded to
97support optional selected functionality. If a download fails a URL will
98be displayed and init will wait for the user to manually download the JAR
99and store it in the target location.
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800100
Fredrik Luthander833aa742011-10-27 21:07:46 +0200101When the init phase is complete, the daemon will be automatically started
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800102in the background and your web browser will open to the site:
103
104----
105 Initialized /home/gerrit2/review_site
106 Executing /home/gerrit2/review_site/bin/gerrit.sh start
107 Starting Gerrit Code Review: OK
108 Waiting for server to start ... OK
109 Opening browser ...
110----
111
112When the browser opens, sign in to Gerrit through the web interface.
113The first user to sign-in and register an account will be
114automatically placed into the fully privileged Administrators group,
115permitting server management over the web and over SSH. Subsequent
116users will be automatically registered as unprivileged users.
117
118
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800119== Installation Complete
Fredrik Luthander833aa742011-10-27 21:07:46 +0200120
121Your base Gerrit server is now installed and running. You're now ready to
122either set up more projects or start working with the projects you've already
123imported.
124
125
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800126[[project_setup]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800127== Project Setup
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800128
Stefan Lay08ba4732014-05-05 16:36:12 +0200129See link:project-configuration.html[Project Configuration] for further details on
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800130how to register a new project with Gerrit. This step is necessary
131if existing Git repositories were not imported during 'init'.
132
133
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100134[[rc_d]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800135== Start/Stop Daemon
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800136
137To control the Gerrit Code Review daemon that is running in the
138background, use the rc.d style start script created by 'init':
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800139
140====
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800141 review_site/bin/gerrit.sh start
142 review_site/bin/gerrit.sh stop
143 review_site/bin/gerrit.sh restart
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800144====
145
David Pursehouse626f8b52013-10-24 13:10:56 +0900146('Optional') Configure the daemon to automatically start and stop
147with the operating system.
148
149Uncomment the following 3 lines in the `'$site_path/bin/gerrit.sh'`
150script:
151
152====
153 chkconfig: 3 99 99
154 description: Gerrit Code Review
155 processname: gerrit
156====
157
158Then link the `gerrit.sh` script into `rc3.d`:
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800159
160====
Kyle Laker839edfc2013-03-08 01:05:10 -0500161 sudo ln -snf `pwd`/review_site/bin/gerrit.sh /etc/init.d/gerrit
162 sudo ln -snf /etc/init.d/gerrit /etc/rc3.d/S90gerrit
Shawn O. Pearce86816ee2009-05-13 17:37:20 -0700163====
164
David Pursehousebe284992013-09-26 14:43:33 +0900165('Optional') To enable autocompletion of the gerrit.sh commands, install
166autocompletion from the `/contrib/bash_completion` script. Refer to the
167script's header comments for installation instructions.
168
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800169To install Gerrit into an existing servlet container instead of using
170the embedded Jetty server, see
171link:install-j2ee.html[J2EE installation].
Shawn O. Pearce86816ee2009-05-13 17:37:20 -0700172
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800173
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800174[[customize]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800175== Site Customization
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800176
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800177Gerrit Code Review supports some site-specific customization options.
David Pursehouse221d4f62012-06-08 17:38:08 +0900178For more information, see the related topics in this manual:
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800179
Francois Marierd550b462011-04-13 14:30:20 +1200180* link:config-reverseproxy.html[Reverse Proxy]
Shawn O. Pearcef384b442009-01-10 16:20:56 -0800181* link:config-sso.html[Single Sign-On Systems]
Dave Borowitz1e49e142013-04-09 12:14:57 -0700182* link:config-themes.html[Themes]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800183* link:config-gitweb.html[Gitweb Integration]
Shawn O. Pearce7b405712009-05-08 18:27:53 -0700184* link:config-gerrit.html[Other System Settings]
Sasa Zivkove5fc90e2013-05-10 15:12:13 +0200185* link:config-auto-site-initialization.html[Automatic Site Initialization on Startup]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800186
Shawn O. Pearce0b91a632009-02-06 12:53:59 -0800187
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800188[[anonymous_access]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800189== Anonymous Access
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800190
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800191Exporting the Git repository directory
192(link:config-gerrit.html#gerrit.basePath[gerrit.basePath]) over the
193anonymous, unencrypted git:// protocol is more efficient than
194Gerrit's internal SSH daemon. See the `git-daemon` documentation
195for details on how to configure this if anonymous access is desired.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800196
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800197* http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[man git-daemon]
Shawn O. Pearceb546c9b2009-02-24 13:12:39 -0800198
199
Martin Fick472bb9d2012-05-08 16:30:16 -0700200[[plugins]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800201== Plugins
Martin Fick472bb9d2012-05-08 16:30:16 -0700202
203Place Gerrit plugins in the review_site/plugins directory to have them loaded on Gerrit startup.
204
205
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800206== External Documentation Links
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800207
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800208* http://www.postgresql.org/docs/[PostgreSQL Documentation]
209* http://dev.mysql.com/doc/[MySQL Documentation]
210* http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[git-daemon]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800211
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700212
213GERRIT
214------
215Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700216
217SEARCHBOX
218---------