How to set local AOSP Gerrit server – Part 1

In this tutorial I’ll explain how to set a local gerrit server that hosts Android source code.

After completing the tutorial you’ll have a fully runnable local AOSP mirror with local Gerrit server.

First thing first. we need a Linux server. if you don’t have one available, you can use a pre-installed Ubuntu 15.04 Server I created – here.
Actually, this tutorial was tested on this machine, so you’re unlikely to get in trouble if you use that.

This tutorial assumes that package management is apt-get. If you’re using other, please do the appropriate adjustments.

Gerrit Prerequisites:

1. Java JDK > 1.7
2. Git
3. SSH server
4. DB

I choose to work with mySQL, put you can also work with various other DB software. consult the Gerrit documentation here.

Here is a short command to get you everything you need:

$ sudo apt-get install git openjdk-8-jre openssh-server mysql-server gitweb

Download and install Android repo

$ sudo curl > /usr/bin/repo
$ sudo chmod a+x /usr/bin

Now we need to set a local mirror of Android. It will take a while, go do something else in the meanwhile…

$ mkdir -p /usr/local/aosp/mirror
$ cd /usr/local/aosp/mirror
$ repo init -u --mirror
$ repo sync

Download Gerrit.

You’re done with part one… Jump to part two of this tutorial

How to set local AOSP Gerrit server – Part 1