Gerrit Code Review is a popular open-source web-based code review software. This tutorial will explain how to install Gerrit on Ubuntu Server Latest.
Log in to your Ubuntu Server as a sudo user, then update your system using the following command:
sudo apt update
sudo apt upgrade
Gerrit requires Java JRE to run. Run the following command to install Java:
sudo apt install openjdk-8-jre-headless
Verify Java installation by running following command:
java -version
The easiest way to install Gerrit is to download the Gerrit server package from the Gerrit Code Review website.
cd /tmp
wget https://gerrit-releases.storage.googleapis.com/gerrit-3.5.1.war
Once downloaded, move the gerrit.war
package to the /opt/gerrit
directory:
sudo mkdir -p /opt/gerrit
sudo mv /tmp/gerrit-3.5.1.war /opt/gerrit/gerrit.war
The next step is to configure Gerrit based on your needs. The Gerrit configuration file is located in /opt/gerrit/etc/gerrit.config
.
Edit the configuration file and ensure that the following line is uncommented:
[gerrit]
basePath = git
serverId = gerrit-server
canonicalWebUrl = http://localhost:8080/
[database]
type = postgresql
hostname = localhost
database = reviewdb
username = gerrit2
To start Gerrit, you need to execute the gerrit.war
file. Execute the following command to start Gerrit:
cd /opt/gerrit
java -jar gerrit.war init -batch -d ~/gerrit
This will perform an initialization process of Gerrit with parameters specified in the configuration file.
Now start the Gerrit service with the following command:
sudo systemctl start gerrit.service
You can access the Gerrit web interface by opening a browser and navigating to http://Your_Server_IP:8080
.
You will be asked to configure your admin account. Once you have configured your admin account, you will have access to the Gerrit web interface.
In this tutorial, you learned how to install Gerrit on Ubuntu Server Latest. You can now use Gerrit to perform code reviews and collaboration for your projects.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!