Getting started with Gerrit Installation

Source: Internet
Author: User
Tags http authentication openid
Introduction

Gerrit is a Web-based code review and project management tool for projects based on the GIT version control system.

  • Official Website
  • Background
  • Download
  • Document

 

The following uses the installation of gerrit-2.1.7-rc1 on ubuntu10.04 as an example:

Create a Gerrit user (optional)
$ sudo adduser gerrit2$ sudo su gerrit2$ cd ~gerrit2

Install Gerrit

Download Gerrit-$ version-rc1.war;

Run:

$ java -jar gerrit-$version-rc1.war init -d review_site 

The Installation Process of command line interaction is as follows:

Create '/home/gerrit2/review-site' [Y/n]?*** Git Repositories***Location of Git repositories [git]:*** SQL Database***Database server type [H2/?]:*** User Authentication***Authentication method [OPENID/?]: http   Get username from custom HTTP header [y/N]? :SSO logout URL : *** Email Delivery***SMTP server hostname [localhost]: SMTP server port [(default)]:SMTP encryption [NONE/?]:SMTP username [gerrit2]: jushi@taobao.com's password :confirm password :*** Container Process***Run as [gerrit2]:Java runtime [/usr/lib/jvm/java-6-sun-1.6.0.24/jre]:Copy gerrit.war to /home/gerrit2/review-site/bin/gerrit.war [Y/n]?Copying gerrit.war to /home/gerrit2/review-site/bin/gerrit.war*** SSH Daemon***Listen on address [*]:Listen on port [29418]:Gerrit Code Review is not shipped with Bouncy Castle Crypto v144  If available, Gerrit can take advantage of features  in the library, but will also function without it.Download and install it now [Y/n]? Downloading http://www.bouncycastle.org/download/bcprov-jdk16-144.jar ... OKChecksum bcprov-jdk16-144.jar OKGenerating SSH host key ... rsa... dsa... done*** HTTP Daemon*** Behind reverse proxy           [y/N]? yProxy uses SSL (https://)      [y/N]? Subdirectory on proxy server   [/]: Listen on address              [*]: Listen on port                 [8081]: Initialized /home/gerrit2/review-siteExecuting /home/gerrit2/review-site/bin/gerrit.sh startStarting Gerrit Code Review: OK

Most of the above answers are answered by default by carriage return, which are worth noting:

  1. The authentication method does not select openid, but HTTP, because this will make Gerrit dependent on external systems. Currently, Gerrit supports openid provided by Google and Yahoo, the trial is not stable (maybe GFW Fu );
  2. In SMTP configuration, select the appropriate service address and account;
  3. Select Reverse Proxy Support, which is related to HTTP authentication;
  4. After configuration, the installation script automatically starts Gerrit.
Configure apache2 reverse proxy
$ sudo apt-get install apache2

Add the content to/etc/apache2/httpd. conf.

<VirtualHost *>  ServerName gerrit2.example.com  ProxyRequests Off  ProxyVia Off  ProxyPreserveHost On  <Proxy *>        Order deny,allow        Allow from all  </Proxy>   <Location /login/>     AuthType Basic     AuthName "Gerrit Code Review"     AuthBasicProvider file     AuthUserFile $gerrit.home/etc/passwords     Require valid-user  </Location>  ProxyPass / http://$gerrit.host:8081/</VirtualHost>

Note: In proxypass, $ Gerrit. Host should be replaced by the external IP address of the server.

Create a user accessing Gerrit

Because HTTP basic authentication is performed through Apache, you can create an account using a command similar to the following:

$ htpassword $gerrit.home/etc/passwords $username
Register a user accessing Gerrit

Use the account created above to log on to http: // $ Gerrit. Host. the browser will automatically jump to the registration page, enter full name, and save;

By the way, you can upload the public key.

Click "continue" to complete registration.

Create a project

After adding the public key, you are advised to create the file config in $ user. Home/. SSH and enter the following content:

Host $shortnameUser $usernamePort 29418Hostname $gerrit.hostIdentityFile $path/to/private/key$

This file is optional, just to facilitate the execution of SSH commands.

To create a project, run the following command:

$ ssh $gerrit.host gerrit create-project -n $project.name

This command starts a bare library under $ gerrrit. Home/git. The newly created Project can be seen in webui.

For more command lines, see here.

Others

For most of the above content, you can refer to this blog. The rest depends on official documents and Google, good luck!

Http://my.oschina.net/zhongl/blog/33017

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.