Dcycle Blog

Setting up Gerrit on CentOS for evaluation

December 02, 2014

Gerrit is a free open-source code review platform created by Google. Here is how to set up a quick, insecure version of Gerrit for evaluation.

You might also be interested in Phabricator (installing, linking with git, and reviewing code), another product which I am also evaluating for code review.

Step 1: get a new server

I do not recommend installing this on an existing server or alongside other software. Start with a new CentOS 6.x server with 1 Gb of RAM (I used Digital Ocean). Note your server IP address (1.2.3.4).

Step 2: set up a subdomain to point to your server

Using your domain management system (I use AlternC hosted at Koumbit), create a new subdomain (gerrit.example.com) which points to 1.2.3.4.

Step 3: Create a directory for storing git repos

Because this server is for evaluation purposes, we will run as root. Do not do this if you decide to use Gerrit for production. We need to create a directory to store our git repos:

mkdir /root/git

Step 4: Download Java, Git and Gerrit

Start by finding the path the latest Gerrit war using a web search. In our case we will use http://gerrit-releases.storage.googleapis.com/gerrit-2.9.2.war

cd /tmp
sudo yum install wget
sudo yum install git
sudo yum install java-1.7.0-openjdk
wget http://gerrit-releases.storage.googleapis.com/gerrit-2.9.2.war

Now run the following command and give the default replies for all questions except the Git repo location, which, instead of “git”, should be “/root/git”.

sudo java -jar gerrit*.war init -d /srv/gerrit

Step 5: Start the Gerrit daemon

/srv/gerrit/bin/gerrit.sh start

Now you can visit gerrit.example.com:8080 and you will see the Gerrit dashboard!

Next step

Next step

Resources