Gerrit(0): Install and Config

Install(Ubuntu 17.04):

apt-get install default-jre daemon [nginx]  #Other OS: install openjdk8-jre [nginx]
wget https://gerrit-releases.storage.googleapis.com/gerrit-2.13.war    #2.14 版本不够稳定,使用 2.13 版
java -jar gerrit-2.13.war init -d /installPath

gerrit.config: 

[gerrit]
    basePath = git
    serverId = ecf8d527-9d8e-4c2a-aca3-b7727ff9011c
# 提供服务的地址、端口 canonicalWebUrl
= http://192.168.0.254:10080/ [database] type = h2 database = /usr/home/gerrit/codeReview/db/ReviewDB [index] type = LUCENE [auth] type = OPENID [receive] enableSignedPush = false [sendemail] smtpServer = smtp.163.com smtpServerPort = 465 smtpEncryption = SSL smtpUser = ...@163.com smtpPass = ... from = CodeReview<...@163.com> [container] user = gerrit javaHome = /usr/local/openjdk8-jre [sshd]
# 连接 gerrit 内部 ssh 服务的地址、端口 listenAddress
= 192.168.0.254:29418 [httpd] listenUrl = http://192.168.0.254:10080/ [cache] directory = cache

<可选> nginx.conf: 

#-----------------------------------------------------------------------------#
        server {
                listen 192.168.0.254:80;
                server_name gerrit.peersafe.com;

                auth_basic "Hello World!";
                auth_basic_user_file /usr/home/gerrit/codeReview/pwd.conf;

                location / {
                        proxy_pass        http://127.0.0.1:10080;
                        proxy_set_header  X-Forwarded-For $remote_addr;
                        proxy_set_header  Host $host;
                }
        }
#-----------------------------------------------------------------------------#

<可选,nginx 认证需要> Create pwd.conf:

echo "yourUserName:$(openssl passwd -crypt yourPassWord)" >> pwd.conf

Ops: 

.../bin/gerrit.sh start/restart/stop

...

原文地址:https://www.cnblogs.com/hadex/p/6796335.html