blob: 1d6d1bd8069f7b43ceacf1d0271b01a9fee0f8ef [file] [log] [blame]
Jason Huntley25bbd512012-08-02 11:10:31 -04001Gerrit Code Review - Standalone Daemon Installation Guide
2=========================================================
Shawn O. Pearced2b73db2009-01-09 11:55:47 -08003
Fredrik Luthander833aa742011-10-27 21:07:46 +02004[[requirements]]
5Requirements
Martin Fick472bb9d2012-05-08 16:30:16 -07006------------
Fredrik Luthander833aa742011-10-27 21:07:46 +02007To run the Gerrit service, the following requirements must be met on
8the host:
9
10* JDK, minimum version 1.6 http://www.oracle.com/technetwork/java/javase/downloads/index.html[Download]
11
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
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080015
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080016[[download]]
17Download Gerrit
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080018---------------
19
Shawn O. Pearce31af1ff2009-01-26 12:04:41 -080020Current and past binary releases of Gerrit can be obtained from
David Pursehouse8d2b4a02013-10-18 11:01:28 +090021the link:https://gerrit-releases.storage.googleapis.com/index.html[
22Gerrit Releases site].
Shawn O. Pearce31af1ff2009-01-26 12:04:41 -080023
Shawn O. Pearce8ddb8cb2009-09-28 12:21:28 -070024Download any current `*.war` package. The war will be referred to as
25`gerrit.war` from this point forward, so you may find it easier to
Anthonyd3aed4c2009-09-26 13:48:10 -040026rename the downloaded file.
Shawn O. Pearceb8527ea2009-02-02 15:39:12 -080027
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080028If you would prefer to build Gerrit directly from source, review
29the notes under link:dev-readme.html[developer setup].
Shawn O. Pearce31af1ff2009-01-26 12:04:41 -080030
Jason Huntley25bbd512012-08-02 11:10:31 -040031include::database-setup.txt[]
Shawn O. Pearce0b91a632009-02-06 12:53:59 -080032
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080033[[init]]
34Initialize the Site
35-------------------
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080036
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080037Gerrit stores configuration files, the server's SSH keys, and the
38managed Git repositories under a local directory, typically referred
39to as `'$site_path'`. If the embedded H2 database is being used,
40its data files will also be stored under this directory.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080041
Fredrik Luthander833aa742011-10-27 21:07:46 +020042You also have to decide where to store your server side git repositories. This
43can either be a relative path under `'$site_path'` or an absolute path
44anywhere on your server system. You have to choose a place before commencing
45your init phase.
46
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080047Initialize a new site directory by running the init command, passing
48the path of the site directory to be created as an argument to the
49'-d' option. Its recommended that Gerrit Code Review be given its
50own user account on the host system:
51
52----
53 sudo adduser gerrit2
54 sudo su gerrit2
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080055
Fredrik Luthander833aa742011-10-27 21:07:46 +020056 java -jar gerrit.war init -d /path/to/your/gerrit_application_directory
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080057----
58
Fredrik Luthander833aa742011-10-27 21:07:46 +020059'Please note:' If you choose a location where your new user doesn't
60have any privileges, you may have to manually create the directory first and
61then give ownership of that location to the `'gerrit2'` user.
62
63If run from an interactive terminal, the init command will prompt through a
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080064series of configuration questions, including gathering information
Fredrik Luthander833aa742011-10-27 21:07:46 +020065about the database created above. If the terminal is not interactive,
66running the init command will choose some reasonable default selections,
67and will use the embedded H2 database. Once the init phase is complete,
68you can review your settings in the file `'$site_path/etc/gerrit.config'`.
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080069
Fredrik Luthander833aa742011-10-27 21:07:46 +020070When running the init command, additional JARs might be downloaded to
71support optional selected functionality. If a download fails a URL will
72be displayed and init will wait for the user to manually download the JAR
73and store it in the target location.
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080074
Fredrik Luthander833aa742011-10-27 21:07:46 +020075When the init phase is complete, the daemon will be automatically started
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080076in the background and your web browser will open to the site:
77
78----
79 Initialized /home/gerrit2/review_site
80 Executing /home/gerrit2/review_site/bin/gerrit.sh start
81 Starting Gerrit Code Review: OK
82 Waiting for server to start ... OK
83 Opening browser ...
84----
85
86When the browser opens, sign in to Gerrit through the web interface.
87The first user to sign-in and register an account will be
88automatically placed into the fully privileged Administrators group,
89permitting server management over the web and over SSH. Subsequent
90users will be automatically registered as unprivileged users.
91
92
Fredrik Luthander833aa742011-10-27 21:07:46 +020093Installation Complete
94---------------------
95
96Your base Gerrit server is now installed and running. You're now ready to
97either set up more projects or start working with the projects you've already
98imported.
99
100
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800101[[project_setup]]
102Project Setup
103-------------
104
105See link:project-setup.html[Project Setup] for further details on
106how to register a new project with Gerrit. This step is necessary
107if existing Git repositories were not imported during 'init'.
108
109
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100110[[rc_d]]
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800111Start/Stop Daemon
112-----------------
113
114To control the Gerrit Code Review daemon that is running in the
115background, use the rc.d style start script created by 'init':
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800116
117====
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800118 review_site/bin/gerrit.sh start
119 review_site/bin/gerrit.sh stop
120 review_site/bin/gerrit.sh restart
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800121====
122
David Pursehouse626f8b52013-10-24 13:10:56 +0900123('Optional') Configure the daemon to automatically start and stop
124with the operating system.
125
126Uncomment the following 3 lines in the `'$site_path/bin/gerrit.sh'`
127script:
128
129====
130 chkconfig: 3 99 99
131 description: Gerrit Code Review
132 processname: gerrit
133====
134
135Then link the `gerrit.sh` script into `rc3.d`:
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800136
137====
Kyle Laker839edfc2013-03-08 01:05:10 -0500138 sudo ln -snf `pwd`/review_site/bin/gerrit.sh /etc/init.d/gerrit
139 sudo ln -snf /etc/init.d/gerrit /etc/rc3.d/S90gerrit
Shawn O. Pearce86816ee2009-05-13 17:37:20 -0700140====
141
David Pursehousebe284992013-09-26 14:43:33 +0900142('Optional') To enable autocompletion of the gerrit.sh commands, install
143autocompletion from the `/contrib/bash_completion` script. Refer to the
144script's header comments for installation instructions.
145
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800146To install Gerrit into an existing servlet container instead of using
147the embedded Jetty server, see
148link:install-j2ee.html[J2EE installation].
Shawn O. Pearce86816ee2009-05-13 17:37:20 -0700149
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800150
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800151[[customize]]
152Site Customization
153------------------
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800154
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800155Gerrit Code Review supports some site-specific customization options.
David Pursehouse221d4f62012-06-08 17:38:08 +0900156For more information, see the related topics in this manual:
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800157
Francois Marierd550b462011-04-13 14:30:20 +1200158* link:config-reverseproxy.html[Reverse Proxy]
Shawn O. Pearcef384b442009-01-10 16:20:56 -0800159* link:config-sso.html[Single Sign-On Systems]
Dave Borowitz1e49e142013-04-09 12:14:57 -0700160* link:config-themes.html[Themes]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800161* link:config-gitweb.html[Gitweb Integration]
Shawn O. Pearce7b405712009-05-08 18:27:53 -0700162* link:config-gerrit.html[Other System Settings]
Sasa Zivkove5fc90e2013-05-10 15:12:13 +0200163* link:config-auto-site-initialization.html[Automatic Site Initialization on Startup]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800164
Shawn O. Pearce0b91a632009-02-06 12:53:59 -0800165
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800166[[anonymous_access]]
167Anonymous Access
168----------------
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800169
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800170Exporting the Git repository directory
171(link:config-gerrit.html#gerrit.basePath[gerrit.basePath]) over the
172anonymous, unencrypted git:// protocol is more efficient than
173Gerrit's internal SSH daemon. See the `git-daemon` documentation
174for details on how to configure this if anonymous access is desired.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800175
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800176* http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[man git-daemon]
Shawn O. Pearceb546c9b2009-02-24 13:12:39 -0800177
178
Martin Fick472bb9d2012-05-08 16:30:16 -0700179[[plugins]]
180Plugins
181-------
182
183Place Gerrit plugins in the review_site/plugins directory to have them loaded on Gerrit startup.
184
185
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800186External Documentation Links
187----------------------------
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800188
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800189* http://www.postgresql.org/docs/[PostgreSQL Documentation]
190* http://dev.mysql.com/doc/[MySQL Documentation]
191* http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[git-daemon]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800192
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700193
194GERRIT
195------
196Part of link:index.html[Gerrit Code Review]