Step 1. Install requirements
$ sudo apt-get install uuid uuid-dev zlib1g-dev liblz-dev liblzo2–2 liblzo2-dev lzop git-core curl u-boot-tools mtd-utils android-tools-fsutils openjdk-8-jdk evice-tree-compiler gdisk m4 libz-dev
Step 2. Download REPO
$ mkdir ~/bin
Step 3. Install Gerrit server
$ mkdir ~/gerrit
$ export GERRIT_SITE=~/gerrit
$ java -jar gerrit*.war init — batch — dev -d $GERRIT_SITE
Step 4. Edit the gerrit.config & Launch Gerrit server
I use the simple login strategy. If you have an LDAP server, you can use LDAP for login.
[auth]
type = DEVELOPMENT_BECOME_ANY_ACCOUNT
The detail the gerrit.config as shown:
$ cat ${GERRIT_SITE}/etc/gerrit.config
[gerrit]
basePath = git
serverId = xxx
[container]
javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
javaOptions = "-Xmx4096m"
user = abc
javaHome = /usr/lib/jvm/java-11-openjdk-amd64
[index]
type = lucene
[auth]
type = DEVELOPMENT_BECOME_ANY_ACCOUNT
[receive]
enableSignedPush = false
[sendemail]
enable = true
smtpServer = mail.xxx.com
from = GERRIT_ROBOT@xxx.com
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = http://*:8080/
[cache]
directory = cache
[plugins]
allowRemoteAdmin = true
Launch Gerrit server
$ cd ${GERRIT_SITE}/bin
$ sudo ./gerrit.sh start
Step 5. Regist an account on your Gerrit server
Open the Gerrit website
http://${gerrit_server_IP}:8080
Regist an account
Step 6. Setup SSH key & Verify SSH connection
Setup SSH key
1. Get your ssh-key from ~/.ssh/id_rsa.pub
$ cat ~/.ssh/id_rsa.pub
2. Copy the string of id_rsa.pub and paste it into "New SSH key"
3. Verify SSH connection
$ ssh -p 29418 USER_NAME@${gerrit_server_IP}
If successful, you will get the message as follows.
**** Welcome to Gerrit Code Review ****
Hi USER_NAME, you have successfully connected over SSH.
Unfortunately, interactive shells are disabled.
To clone a hosted Git repository, use:
git clone ssh://USER_NAME@${gerrit_server_IP}:29418/REPOSITORY_NAME.git
Connection to ${gerrit_server_IP} closed by remote host.
Connection to ${gerrit_server_IP} closed.