---
# System prepended metadata

title: Install Gerrit 3.2.6 on Linux system
tags: [Gerrit, Linux]

---

# Install Gerrit 3.2.6 on Linux system

## Install OpenJDK 1.8 Runtime
```shell=
$ sudo apt install openjdk-8-jre
$ java -version
openjdk version "1.8.0_275"
OpenJDK Runtime Environment (build 1.8.0_275-8u275-b01-0ubuntu1~20.04-b01)
OpenJDK 64-Bit Server VM (build 25.275-b01, mixed mode)
```

## Download Gerrit 3.2.6
```shell=
wget https://gerrit-releases.storage.googleapis.com/gerrit-3.2.6.war
```

## Install and Init Gerrit 3.2.6
```shell=
$ export GERRIT_SITE=~/gerrit_testsite
$ java -jar gerrit*.war init --batch --dev -d $GERRIT_SITE
```

- --dev => 開發模式，權限會是任何人皆可自由切換身分，無須密碼，算是提供初步測試Gerrit用。
- --batch => 以一些預設參數去設定Gerrit config。

## Run or Stop Gerrit 3.2.6

### Run
```shell=
$ sudo su
$ export GERRIT_SITE=/path_of_gerrit
$ ~/$(GERRIT_SITE)/bin/gerrit.sh start
```

### Stop
```shell=
$ sudo su
$ export GERRIT_SITE=/path_of_gerrit
$ ~/$(GERRIT_SITE)/bin/gerrit.sh stop
```



###### tags: `Gerrit` `Linux`