Original source: http://www.linuxidc.com/Linux/2013-02/79999.htm
1. Install ubuntu12.xx (I am using 12.10, other versions not tested)
2. Configuring the Java Environment
Download Jdk-6u34-linux-x64.bin (Baidu Google), the terminal to perform the installation (if no permissions, then perform chmod a+x jdk-6u34-linux-x64.bin)
$:./jdk-6u34-linux-x64.bin
The installation is performed automatically. When you are finished installing, configure the relevant environment variables
$: Vim ~/.BASHRC
Add the following environment variables: (username for your user name)
Java_home=/home/username/jdk1.6.0_34
Export Jre_home= $JAVA _home/jre
Export classpath= $JAVA _home/lib: $JRE _home/lib: $CLASSPATH
Export path= $JAVA _home/bin: $JRE _home/bin: $PATH
$: Source ~/.BASHRC
Verify that the configuration is successful:
$: java-version
$: Javac
If the above terminal command does not return an error, and has normal version information and help information, it proves that the Java environment configuration is successful and can continue. If there are errors, please Baidu Google.
3. Configure Gerrit.xxx.war
Open terminal, to the directory where Gerrit.xxx.war, execute:
$: Java-jar Gerrit.xxx.war init-d Review_site
Create '/home/username/review_site ' [y/n]?
...
Basically is all the way to go down, the default configuration is good, need to say is the verification method Openid,openid can use Google and Yahoo Mail login, but some times due to GFW reasons, these may not be useful, so you can choose HTTP (recommended). The type of database you manage varies from person to person, with whatever you like, by default, H2.
After the configuration is complete, the gerrit.sh script will be automatically called to start the Gerrit service, and the browser will automatically open, this time must be a failure, because there is no configuration apache2.
You need to make minor changes to the Gerrit configuration file before configuring Apache2, which is review_site/etc/gerrit.config
Change the Canonicalweburl under Field [Gerrit] to https://127.0.0.1:8081/
Change the listenurl under Field [httpd] to proxy-https://127.0.0.1:8081/
Save it.
PS: I was looking for this article, mainly used in the above two lines, where the file also has a field named [httpd], this port number is also consistent with the above.
Gerrit Audit Server Setup Easy Tutorial (Ubuntu 12.10)