Jason Huntley | 25bbd51 | 2012-08-02 11:10:31 -0400 | [diff] [blame] | 1 | Gerrit Code Review - Standalone Daemon Installation Guide |
| 2 | ========================================================= |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 3 | |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 4 | [[requirements]] |
| 5 | Requirements |
Martin Fick | 472bb9d | 2012-05-08 16:30:16 -0700 | [diff] [blame] | 6 | ------------ |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 7 | To run the Gerrit service, the following requirements must be met on |
| 8 | the host: |
| 9 | |
| 10 | * JDK, minimum version 1.6 http://www.oracle.com/technetwork/java/javase/downloads/index.html[Download] |
| 11 | |
David Pursehouse | 3be717b | 2013-05-13 13:56:11 +0900 | [diff] [blame] | 12 | You'll also need an SQL database to house the review metadata. You have the |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 13 | choice of either using the embedded H2 or to host your own MySQL or PostgreSQL. |
| 14 | |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 15 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 16 | [[download]] |
| 17 | Download Gerrit |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 18 | --------------- |
| 19 | |
Shawn O. Pearce | 31af1ff | 2009-01-26 12:04:41 -0800 | [diff] [blame] | 20 | Current and past binary releases of Gerrit can be obtained from |
| 21 | the downloads page at the project site: |
| 22 | |
| 23 | * http://code.google.com/p/gerrit/downloads/list[Gerrit Downloads] |
| 24 | |
Shawn O. Pearce | 8ddb8cb | 2009-09-28 12:21:28 -0700 | [diff] [blame] | 25 | Download any current `*.war` package. The war will be referred to as |
| 26 | `gerrit.war` from this point forward, so you may find it easier to |
Anthony | d3aed4c | 2009-09-26 13:48:10 -0400 | [diff] [blame] | 27 | rename the downloaded file. |
Shawn O. Pearce | b8527ea | 2009-02-02 15:39:12 -0800 | [diff] [blame] | 28 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 29 | If you would prefer to build Gerrit directly from source, review |
| 30 | the notes under link:dev-readme.html[developer setup]. |
Shawn O. Pearce | 31af1ff | 2009-01-26 12:04:41 -0800 | [diff] [blame] | 31 | |
Jason Huntley | 25bbd51 | 2012-08-02 11:10:31 -0400 | [diff] [blame] | 32 | include::database-setup.txt[] |
Shawn O. Pearce | 0b91a63 | 2009-02-06 12:53:59 -0800 | [diff] [blame] | 33 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 34 | [[init]] |
| 35 | Initialize the Site |
| 36 | ------------------- |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 37 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 38 | Gerrit stores configuration files, the server's SSH keys, and the |
| 39 | managed Git repositories under a local directory, typically referred |
| 40 | to as `'$site_path'`. If the embedded H2 database is being used, |
| 41 | its data files will also be stored under this directory. |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 42 | |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 43 | You also have to decide where to store your server side git repositories. This |
| 44 | can either be a relative path under `'$site_path'` or an absolute path |
| 45 | anywhere on your server system. You have to choose a place before commencing |
| 46 | your init phase. |
| 47 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 48 | Initialize a new site directory by running the init command, passing |
| 49 | the path of the site directory to be created as an argument to the |
| 50 | '-d' option. Its recommended that Gerrit Code Review be given its |
| 51 | own user account on the host system: |
| 52 | |
| 53 | ---- |
| 54 | sudo adduser gerrit2 |
| 55 | sudo su gerrit2 |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 56 | |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 57 | java -jar gerrit.war init -d /path/to/your/gerrit_application_directory |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 58 | ---- |
| 59 | |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 60 | 'Please note:' If you choose a location where your new user doesn't |
| 61 | have any privileges, you may have to manually create the directory first and |
| 62 | then give ownership of that location to the `'gerrit2'` user. |
| 63 | |
| 64 | If run from an interactive terminal, the init command will prompt through a |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 65 | series of configuration questions, including gathering information |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 66 | about the database created above. If the terminal is not interactive, |
| 67 | running the init command will choose some reasonable default selections, |
| 68 | and will use the embedded H2 database. Once the init phase is complete, |
| 69 | you can review your settings in the file `'$site_path/etc/gerrit.config'`. |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 70 | |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 71 | When running the init command, additional JARs might be downloaded to |
| 72 | support optional selected functionality. If a download fails a URL will |
| 73 | be displayed and init will wait for the user to manually download the JAR |
| 74 | and store it in the target location. |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 75 | |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 76 | When the init phase is complete, the daemon will be automatically started |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 77 | in the background and your web browser will open to the site: |
| 78 | |
| 79 | ---- |
| 80 | Initialized /home/gerrit2/review_site |
| 81 | Executing /home/gerrit2/review_site/bin/gerrit.sh start |
| 82 | Starting Gerrit Code Review: OK |
| 83 | Waiting for server to start ... OK |
| 84 | Opening browser ... |
| 85 | ---- |
| 86 | |
| 87 | When the browser opens, sign in to Gerrit through the web interface. |
| 88 | The first user to sign-in and register an account will be |
| 89 | automatically placed into the fully privileged Administrators group, |
| 90 | permitting server management over the web and over SSH. Subsequent |
| 91 | users will be automatically registered as unprivileged users. |
| 92 | |
| 93 | |
Fredrik Luthander | 833aa74 | 2011-10-27 21:07:46 +0200 | [diff] [blame] | 94 | Installation Complete |
| 95 | --------------------- |
| 96 | |
| 97 | Your base Gerrit server is now installed and running. You're now ready to |
| 98 | either set up more projects or start working with the projects you've already |
| 99 | imported. |
| 100 | |
| 101 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 102 | [[project_setup]] |
| 103 | Project Setup |
| 104 | ------------- |
| 105 | |
| 106 | See link:project-setup.html[Project Setup] for further details on |
| 107 | how to register a new project with Gerrit. This step is necessary |
| 108 | if existing Git repositories were not imported during 'init'. |
| 109 | |
| 110 | |
Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 111 | [[rc_d]] |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 112 | Start/Stop Daemon |
| 113 | ----------------- |
| 114 | |
| 115 | To control the Gerrit Code Review daemon that is running in the |
| 116 | background, use the rc.d style start script created by 'init': |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 117 | |
| 118 | ==== |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 119 | review_site/bin/gerrit.sh start |
| 120 | review_site/bin/gerrit.sh stop |
| 121 | review_site/bin/gerrit.sh restart |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 122 | ==== |
| 123 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 124 | ('Optional') Link the gerrit.sh script into rc3.d so the daemon |
| 125 | automatically starts and stops with the operating system: |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 126 | |
| 127 | ==== |
Kyle Laker | 839edfc | 2013-03-08 01:05:10 -0500 | [diff] [blame] | 128 | sudo ln -snf `pwd`/review_site/bin/gerrit.sh /etc/init.d/gerrit |
| 129 | sudo ln -snf /etc/init.d/gerrit /etc/rc3.d/S90gerrit |
Shawn O. Pearce | 86816ee | 2009-05-13 17:37:20 -0700 | [diff] [blame] | 130 | ==== |
| 131 | |
David Pursehouse | be28499 | 2013-09-26 14:43:33 +0900 | [diff] [blame] | 132 | ('Optional') To enable autocompletion of the gerrit.sh commands, install |
| 133 | autocompletion from the `/contrib/bash_completion` script. Refer to the |
| 134 | script's header comments for installation instructions. |
| 135 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 136 | To install Gerrit into an existing servlet container instead of using |
| 137 | the embedded Jetty server, see |
| 138 | link:install-j2ee.html[J2EE installation]. |
Shawn O. Pearce | 86816ee | 2009-05-13 17:37:20 -0700 | [diff] [blame] | 139 | |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 140 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 141 | [[customize]] |
| 142 | Site Customization |
| 143 | ------------------ |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 144 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 145 | Gerrit Code Review supports some site-specific customization options. |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 146 | For more information, see the related topics in this manual: |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 147 | |
Francois Marier | d550b46 | 2011-04-13 14:30:20 +1200 | [diff] [blame] | 148 | * link:config-reverseproxy.html[Reverse Proxy] |
Shawn O. Pearce | f384b44 | 2009-01-10 16:20:56 -0800 | [diff] [blame] | 149 | * link:config-sso.html[Single Sign-On Systems] |
Dave Borowitz | 1e49e14 | 2013-04-09 12:14:57 -0700 | [diff] [blame] | 150 | * link:config-themes.html[Themes] |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 151 | * link:config-gitweb.html[Gitweb Integration] |
Shawn O. Pearce | 7b40571 | 2009-05-08 18:27:53 -0700 | [diff] [blame] | 152 | * link:config-gerrit.html[Other System Settings] |
Sasa Zivkov | e5fc90e | 2013-05-10 15:12:13 +0200 | [diff] [blame] | 153 | * link:config-auto-site-initialization.html[Automatic Site Initialization on Startup] |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 154 | |
Shawn O. Pearce | 0b91a63 | 2009-02-06 12:53:59 -0800 | [diff] [blame] | 155 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 156 | [[anonymous_access]] |
| 157 | Anonymous Access |
| 158 | ---------------- |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 159 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 160 | Exporting the Git repository directory |
| 161 | (link:config-gerrit.html#gerrit.basePath[gerrit.basePath]) over the |
| 162 | anonymous, unencrypted git:// protocol is more efficient than |
| 163 | Gerrit's internal SSH daemon. See the `git-daemon` documentation |
| 164 | for details on how to configure this if anonymous access is desired. |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 165 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 166 | * http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[man git-daemon] |
Shawn O. Pearce | b546c9b | 2009-02-24 13:12:39 -0800 | [diff] [blame] | 167 | |
| 168 | |
Martin Fick | 472bb9d | 2012-05-08 16:30:16 -0700 | [diff] [blame] | 169 | [[plugins]] |
| 170 | Plugins |
| 171 | ------- |
| 172 | |
| 173 | Place Gerrit plugins in the review_site/plugins directory to have them loaded on Gerrit startup. |
| 174 | |
| 175 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 176 | External Documentation Links |
| 177 | ---------------------------- |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 178 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 179 | * http://www.postgresql.org/docs/[PostgreSQL Documentation] |
| 180 | * http://dev.mysql.com/doc/[MySQL Documentation] |
| 181 | * http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[git-daemon] |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 182 | |
Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 183 | |
| 184 | GERRIT |
| 185 | ------ |
| 186 | Part of link:index.html[Gerrit Code Review] |