gerrit安装笔记

简介

         这两天在折腾敏捷开发,安装gerrit,折腾惨了。郁闷啊,主要是apache的配置文件不熟悉,好多配置都是瞎配置。导致到处出错。

系统:

root@pm:/var/www# uname -a
Linux pm 3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
root@pm:/var/www# 

错误一

Configuration Error
Check the HTTP server's authentication settings.
The HTTP server did not provide the username in the Authorization header when it forwarded the request to Gerrit Code Review.
If the HTTP server is Apache HTTPd, check the proxy configuration includes an authorization directive with the proper location, ensuring it ends with '/':

解决:

修改apache的ports.conf 文件,在里面添加对应的端口。

root@pm:/etc/apache2# cat ports.conf   
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

NameVirtualHost *:80
NameVirtualHost *:8090
Listen 80
Listen 8090

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

root@pm:/etc/apache2# 

错误二

Check the HTTP server's authentication settings.
The HTTP server did not provide the username in the Authorization
header when it forwarded the request to Gerrit Code Review.

If the HTTP server is Apache HTTPd, check the proxy configuration
includes an authorization directive with the proper location, ensuring
it ends with '/':

<VirtualHost kona-gerrit:8080>
ServerName kona-gerrit

ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

<Location /login/>
AuthType Basic
AuthName "Gerrit Code Review"
Require valid-user
...
</Location>
ProxyPass / http://.../
</VirtualHost>
解决:

是你的代理配置没有配好。

该死的,就这个错误和下面这个错误,害的我整了整整2天。郁闷死我了。


错误三

gerrit 重定向循环
解决:在gerrit的配置文件中增加:

root@pm:/data/app/git/review_site# cat etc/gerrit.config 
[gerrit]
        basePath = git
        canonicalWebUrl = http://192.168.16.118:8090/  #这一句明确了,就可以解决重定向的错误。注意,此处是填写apache中配的代理地址,而不是gerrit的listenUrl地址。


我的配置

apache2的配置:

</VirtualHost>


<VirtualHost *:8090>
        ServerName 10.0.16.8
        ProxyRequests Off  
        ProxyVia Off  
        ProxyPreserveHost On  
  
    <Proxy *>  
          Order deny,allow  
          Allow from all  
    </Proxy>  
  
    <Location "/login/">  
      AuthType Basic  
      AuthName "Gerrit Code Review"  
      Require valid-user  
        AuthBasicProvider file 
      AuthUserFile /data/app/git/review_site/etc/passwd  
    </Location>  
  
    ProxyPass / http://127.0.0.1:8080/  
#ProxyPassReverse / http://127.0.0.1:8080/
#SetEnv force-proxy-request-1.0.1
#SetEnv proxy-nokeepalive 1  
</VirtualHost>
ports.conf文件:

root@pm:~/bin# cat /etc/apache2/ports.conf 
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

NameVirtualHost *:80
NameVirtualHost *:8090
Listen 80
Listen 8090

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

root@pm:~/bin# 

gerrit的配置:

root@pm:~/bin# cat /data/app/git/review_site/etc/gerrit.config 
[gerrit]
        basePath = git
        canonicalWebUrl = http://192.168.16.118:8090/
[database]
        type = MYSQL
        hostname = localhost
        database = reviewdb
        username = git
[auth]
        type = HTTP
[sendemail]
        smtpServer = localhost
[container]
        user = git
        javaHome = /usr/lib/jvm/jdk1.6.0_37/jre
[sshd]
        listenAddress = *:29418
[httpd]
        listenUrl = http://*:8080/
[cache]
        directory = cache
root@pm:~/bin# 

参考

http://stackoverflow.com/questions/18179728/set-up-gerrit-with-http-authentication

ProxyPass与ProxyPassReverse及ProxyPassMatch的概述

Gerrit简易安装入门

Ubuntu下安装Gerrit

Ubuntu 建立 Gerrit服务器 配置文件
烤鸭的gerrit使用说明




  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值