Marian Harbach | ebeb154 | 2019-12-13 10:42:46 +0100 | [diff] [blame] | 1 | :linkattrs: |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 2 | = Quickstart for Installing Gerrit on Linux |
| 3 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 4 | This content explains how to install a basic instance of Gerrit on a Linux |
| 5 | machine. |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 6 | |
| 7 | [NOTE] |
| 8 | ==== |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 9 | This quickstart is provided for demonstration purposes only. The Gerrit instance |
| 10 | they install must not be used in a production environment. |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 11 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 12 | Instead, to install a Gerrit production environment, see |
David Shevitz | bcd0d24 | 2017-10-01 02:11:07 -0700 | [diff] [blame] | 13 | link:install.html[Standalone Daemon Installation Guide]. |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 14 | ==== |
| 15 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 16 | == Before you start |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 17 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 18 | Be sure you have: |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 19 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 20 | . A Unix-based server, including any Linux flavor, MacOS, or Berkeley Software |
| 21 | Distribution (BSD). |
Orgad Shaneh | ffef3d8 | 2021-06-08 17:18:52 +0300 | [diff] [blame] | 22 | . Java SE Runtime Environment version 11 and up. |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 23 | |
| 24 | == Download Gerrit |
| 25 | |
| 26 | From the Linux machine on which you want to install Gerrit: |
| 27 | |
| 28 | . Open a terminal window. |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 29 | . Download the desired Gerrit archive. |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 30 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 31 | To view previous archives, see |
Eryk Szymanski | 2aed8cc | 2022-05-10 11:50:13 +0200 | [diff] [blame] | 32 | link:https://gerrit-releases.storage.googleapis.com/index.html[Gerrit Code Review: Releases,role=external,window=_blank]. The steps below install Gerrit 3.5.1: |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 33 | |
| 34 | .... |
Eryk Szymanski | 2aed8cc | 2022-05-10 11:50:13 +0200 | [diff] [blame] | 35 | wget https://gerrit-releases.storage.googleapis.com/gerrit-3.5.1.war |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 36 | .... |
| 37 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 38 | NOTE: To build and install Gerrit from the source files, see |
| 39 | link:dev-readme.html[Gerrit Code Review: Developer Setup]. |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 40 | |
| 41 | == Install and initialize Gerrit |
| 42 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 43 | From the command line, enter: |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 44 | |
| 45 | .... |
Ben Rohlfs | b65406b | 2019-05-02 10:43:40 +0200 | [diff] [blame] | 46 | export GERRIT_SITE=~/gerrit_testsite |
| 47 | java -jar gerrit*.war init --batch --dev -d $GERRIT_SITE |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 48 | .... |
| 49 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 50 | This command takes two parameters: |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 51 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 52 | * `--batch` assigns default values to several Gerrit configuration |
| 53 | options. To learn more about these options, see |
| 54 | link:config-gerrit.html[Configuration]. |
| 55 | * `--dev` configures the Gerrit server to use the authentication |
| 56 | option, `DEVELOPMENT_BECOME_ANY_ACCOUNT`, which enables you to |
| 57 | switch between different users to explore how Gerrit works. To learn more |
| 58 | about setting up Gerrit for development, see |
| 59 | link:dev-readme.html[Gerrit Code Review: Developer Setup]. |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 60 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 61 | While this command executes, status messages are displayed in the terminal |
| 62 | window. For example: |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 63 | |
| 64 | .... |
| 65 | Generating SSH host key ... rsa(simple)... done |
| 66 | Initialized /home/gerrit/gerrit_testsite |
| 67 | Executing /home/gerrit/gerrit_testsite/bin/gerrit.sh start |
| 68 | Starting Gerrit Code Review: OK |
| 69 | .... |
| 70 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 71 | The last message confirms that the Gerrit service is running: |
| 72 | |
| 73 | `Starting Gerrit Code Review: OK`. |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 74 | |
| 75 | == Update the listen URL |
| 76 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 77 | To prevent outside connections from contacting your new Gerrit instance |
| 78 | (strongly recommended), change the URL on which Gerrit listens from `*` to |
| 79 | `localhost`. For example: |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 80 | |
| 81 | .... |
Ben Rohlfs | b65406b | 2019-05-02 10:43:40 +0200 | [diff] [blame] | 82 | git config --file $GERRIT_SITE/etc/gerrit.config httpd.listenUrl 'http://localhost:8080' |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 83 | .... |
| 84 | |
| 85 | == Restart the Gerrit service |
| 86 | |
| 87 | You must restart the Gerrit service for your authentication type and listen URL |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 88 | changes to take effect: |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 89 | |
| 90 | .... |
Ben Rohlfs | b65406b | 2019-05-02 10:43:40 +0200 | [diff] [blame] | 91 | $GERRIT_SITE/bin/gerrit.sh restart |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 92 | .... |
| 93 | |
| 94 | == Viewing Gerrit |
| 95 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 96 | To view your new basic installation of Gerrit, go to: |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 97 | |
| 98 | .... |
| 99 | http://localhost:8080 |
| 100 | .... |
| 101 | |
| 102 | == Next steps |
| 103 | |
Janet Davies | 0c1a621 | 2018-05-09 15:18:57 -0700 | [diff] [blame] | 104 | Now that you have a simple version of Gerrit running, use the installation to |
| 105 | explore the user interface and learn about Gerrit. For more detailed |
| 106 | installation instructions, see |
Kenyon Ralph | 8faf423 | 2021-07-22 17:08:37 -0700 | [diff] [blame] | 107 | link:install.html[Standalone Daemon Installation Guide]. |
David Shevitz | 11a458a | 2017-07-20 15:32:05 -0700 | [diff] [blame] | 108 | |
| 109 | GERRIT |
| 110 | ------ |
| 111 | |
| 112 | Part of link:index.html[Gerrit Code Review] |
| 113 | |
| 114 | SEARCHBOX |
| 115 | --------- |