How to Setup Gerrit

24th of May 2018

What is gerrit?

Gerrit is a free, web-based team code collaboration tool. Software developers in a team can review each other’s modifications on their source code using a Web browser and approve or reject those changes.(Wikipedia)

1. Required packages
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo apt-get install gitweb
sudo apt-get install git-review

a. Google gerrit
b. Gerrit Ci
c. Gerrit group

3. Create gerrit user
sudo useradd gerrit && groupadd gerrit
cd /home
mkdir gerrit
chown -R gerrit:gerrit gerrit
4. Create folders in gerrit
cd /home/gerrit/
mkdir lib && mkdir plugins
5. Setup MySQL

MySQL Ubuntu

6. Setup gerrit MySQL
mysql -p
CREATE USER 'gerrit'@'localhost' IDENTIFIED BY 'yourpassword';
CREATE DATABASE reviewdb;
GRANT ALL ON reviewdb.* TO 'gerrit'@'localhost';
FLUSH PRIVILEGES;
exit;
7. Location for gerrit plugins
/home/gerrit/gerrit*.war
/home/gerrit/lib/github-oauth-2.14-SNAPSHOT.jar
/home/gerrit/plugins/github-plugin-2.14-SNAPSHOT.jar
8. Configure Gerrit
cd /home/gerrit
sudo java -jar gerrit*.war init
sudo java -jar gerrit*.war reindex
cd /home/
sudo chown -R gerrit:gerrit gerrit
9. Gerrit sample config files
  1. Gerrit config
  2. All-projects part-1
  3. All-projects part-2