How to install Gerrit on Linux / Ubuntu

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. It integrates closely with Git, a distributed version control system. Wikipedia

In this post we will show, how to install Gerrit Linux distros specifically Ubuntu.

$ wget -c https://gerrit-releases.storage.googleapis.com/gerrit-3.1.3.war

Now we need to export path / directory where gerrit site will be created using GERRIT_SITE variable.

$ export GERRIT_SITE=~/gerrit_site
$ java -jar gerrit*.war init --batch --dev -d $GERRIT_SITE
[2020-04-07 16:11:40,939] [main] INFO  com.google.gerrit.server.config.GerritServerConfigProvider : No /home/devlab/gerrit_site/etc/gerrit.config; assuming defaults
Generating SSH host key ... rsa... ed25519... ecdsa 256... ecdsa 384... ecdsa 521... done
Initialized /home/devlab/gerrit_site
Reindexing projects:    100% (2/2)
Reindexed 2 documents in projects index in 0.1s (18.2/s)
Executing /home/devlab/gerrit_site/bin/gerrit.sh start
Starting Gerrit Code Review: WARNING: Could not adjust Gerrit's process for the kernel's out-of-memory killer.
         This may be caused by /home/devlab/gerrit_site/bin/gerrit.sh not being run as root.
         Consider changing the OOM score adjustment manually for Gerrit's PID=11529 with e.g.:
         echo '-1000' | sudo tee /proc/11529/oom_score_adj
OK

The above command will initialise the gerrit site at /home/your_user/gerrit_site directory. In our case its “/home/devlab/gerrit_site” directory and during initialisation it will use “/home/devlab/gerrit_site/etc/gerrit.config” as default configuration. You can check and modify this configuration file as your want or can use below command to change the variables as,

$ git config --file $GERRIT_SITE/etc/gerrit.config httpd.listenUrl 'http://localhost:8080'

In above command, you can choose to change the port to some other free port if port 8080 is being used by any other application..

Related :   How to generate upload key and keystore for Android App Signing ?

Now lets start the gerrit server as,

$ $GERRIT_SITE/bin/gerrit.sh restart
Stopping Gerrit Code Review: OK
Starting Gerrit Code Review: WARNING: Could not adjust Gerrit's process for the kernel's out-of-memory killer.
         This may be caused by /home/devlab/gerrit_testsite/bin/gerrit.sh not being run as root.
         Consider changing the OOM score adjustment manually for Gerrit's PID=11790 with e.g.:
         echo '-1000' | sudo tee /proc/11790/oom_score_adj
OK

as seen above, there seems to be some permission problems since we had started the server with standard user, which you can avoid by starting the server with sudo permissions as,

$ sudo $GERRIT_SITE/bin/gerrit.sh restart
sudo] password for devlab:
Stopping Gerrit Code Review: OK
Starting Gerrit Code Review: OK

You are now all set, and you can visit http://localhost:8080 to see the gerrit installed.

References


lynxbee_ezoic

Subscribe with Valid Email Id to receive updates in Inbox. ( Secured by Google FeedBurner )

   


Leave a Comment

Android Android Applications Android Build system Android Commands Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development & Build Development, Debugging and Performance Tools Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web design and development Website Hosting Wordpress Yocto / Bitbake / Openembedded