blob: 13873ed62728cf55e675c4a5dce14a63f5a95946 [file] [log] [blame]
Marian Harbachebeb1542019-12-13 10:42:46 +01001:linkattrs:
David Shevitz11a458a2017-07-20 15:32:05 -07002= Quickstart for Installing Gerrit on Linux
3
Janet Davies0c1a6212018-05-09 15:18:57 -07004This content explains how to install a basic instance of Gerrit on a Linux
5machine.
David Shevitz11a458a2017-07-20 15:32:05 -07006
7[NOTE]
8====
Janet Davies0c1a6212018-05-09 15:18:57 -07009This quickstart is provided for demonstration purposes only. The Gerrit instance
10they install must not be used in a production environment.
David Shevitz11a458a2017-07-20 15:32:05 -070011
Janet Davies0c1a6212018-05-09 15:18:57 -070012Instead, to install a Gerrit production environment, see
David Shevitzbcd0d242017-10-01 02:11:07 -070013link:install.html[Standalone Daemon Installation Guide].
David Shevitz11a458a2017-07-20 15:32:05 -070014====
15
Janet Davies0c1a6212018-05-09 15:18:57 -070016== Before you start
David Shevitz11a458a2017-07-20 15:32:05 -070017
Janet Davies0c1a6212018-05-09 15:18:57 -070018Be sure you have:
David Shevitz11a458a2017-07-20 15:32:05 -070019
Janet Davies0c1a6212018-05-09 15:18:57 -070020. A Unix-based server, including any Linux flavor, MacOS, or Berkeley Software
21 Distribution (BSD).
Orgad Shanehffef3d82021-06-08 17:18:52 +030022. Java SE Runtime Environment version 11 and up.
David Shevitz11a458a2017-07-20 15:32:05 -070023
24== Download Gerrit
25
26From the Linux machine on which you want to install Gerrit:
27
28. Open a terminal window.
Janet Davies0c1a6212018-05-09 15:18:57 -070029. Download the desired Gerrit archive.
David Shevitz11a458a2017-07-20 15:32:05 -070030
Janet Davies0c1a6212018-05-09 15:18:57 -070031To view previous archives, see
Eryk Szymanski2aed8cc2022-05-10 11:50:13 +020032link: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 Shevitz11a458a2017-07-20 15:32:05 -070033
34....
Eryk Szymanski2aed8cc2022-05-10 11:50:13 +020035wget https://gerrit-releases.storage.googleapis.com/gerrit-3.5.1.war
David Shevitz11a458a2017-07-20 15:32:05 -070036....
37
Janet Davies0c1a6212018-05-09 15:18:57 -070038NOTE: To build and install Gerrit from the source files, see
39link:dev-readme.html[Gerrit Code Review: Developer Setup].
David Shevitz11a458a2017-07-20 15:32:05 -070040
41== Install and initialize Gerrit
42
Janet Davies0c1a6212018-05-09 15:18:57 -070043From the command line, enter:
David Shevitz11a458a2017-07-20 15:32:05 -070044
45....
Ben Rohlfsb65406b2019-05-02 10:43:40 +020046export GERRIT_SITE=~/gerrit_testsite
47java -jar gerrit*.war init --batch --dev -d $GERRIT_SITE
David Shevitz11a458a2017-07-20 15:32:05 -070048....
49
Janet Davies0c1a6212018-05-09 15:18:57 -070050This command takes two parameters:
David Shevitz11a458a2017-07-20 15:32:05 -070051
Janet Davies0c1a6212018-05-09 15:18:57 -070052* `--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 Shevitz11a458a2017-07-20 15:32:05 -070060
Janet Davies0c1a6212018-05-09 15:18:57 -070061While this command executes, status messages are displayed in the terminal
62window. For example:
David Shevitz11a458a2017-07-20 15:32:05 -070063
64....
65Generating SSH host key ... rsa(simple)... done
66Initialized /home/gerrit/gerrit_testsite
67Executing /home/gerrit/gerrit_testsite/bin/gerrit.sh start
68Starting Gerrit Code Review: OK
69....
70
Janet Davies0c1a6212018-05-09 15:18:57 -070071The last message confirms that the Gerrit service is running:
72
73`Starting Gerrit Code Review: OK`.
David Shevitz11a458a2017-07-20 15:32:05 -070074
75== Update the listen URL
76
Janet Davies0c1a6212018-05-09 15:18:57 -070077To 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 Shevitz11a458a2017-07-20 15:32:05 -070080
81....
Ben Rohlfsb65406b2019-05-02 10:43:40 +020082git config --file $GERRIT_SITE/etc/gerrit.config httpd.listenUrl 'http://localhost:8080'
David Shevitz11a458a2017-07-20 15:32:05 -070083....
84
85== Restart the Gerrit service
86
87You must restart the Gerrit service for your authentication type and listen URL
Janet Davies0c1a6212018-05-09 15:18:57 -070088changes to take effect:
David Shevitz11a458a2017-07-20 15:32:05 -070089
90....
Ben Rohlfsb65406b2019-05-02 10:43:40 +020091$GERRIT_SITE/bin/gerrit.sh restart
David Shevitz11a458a2017-07-20 15:32:05 -070092....
93
94== Viewing Gerrit
95
Janet Davies0c1a6212018-05-09 15:18:57 -070096To view your new basic installation of Gerrit, go to:
David Shevitz11a458a2017-07-20 15:32:05 -070097
98....
99http://localhost:8080
100....
101
102== Next steps
103
Janet Davies0c1a6212018-05-09 15:18:57 -0700104Now that you have a simple version of Gerrit running, use the installation to
105explore the user interface and learn about Gerrit. For more detailed
106installation instructions, see
Kenyon Ralph8faf4232021-07-22 17:08:37 -0700107link:install.html[Standalone Daemon Installation Guide].
David Shevitz11a458a2017-07-20 15:32:05 -0700108
109GERRIT
110------
111
112Part of link:index.html[Gerrit Code Review]
113
114SEARCHBOX
115---------