$ wget http://openlinux.amlogic.com:8000/deploy/java/sun-java6-bin_6.26-2lucid1_amd64.deb $ wget http://openlinux.amlogic.com:8000/deploy/java/sun-java6-jdk_6.26-2lucid1_amd64.deb $ wget http://openlinux.amlogic.com:8000/deploy/java/sun-java6-jre_6.26-2lucid1_all.deb $ sudo dpkg -i sun-java6* $ apt-get -f install
$ sudo apt-get install apache2
$ sudo adduser gerrit $ sudo su gerrit $ cd ~
$ wget http://gerrit-releases.storage.googleapis.com/gerrit-2.8-rc3.war
$ java -jar gerrit-2.8-rc3.war init -d review_site
$ cat review_site/etc/gerrit.config [gerrit] basePath = git canonicalWebUrl = http://192.168.27.42:8081/gerrit [database] type = h2 database = db/ReviewDB [auth] type = HTTP #httpHeader = SM_USER [sendemail] smtpServer = mail.pptv.com smtpServerPort = 587 smtpEncryption = smtpUser = cmguo smtpPass = 123456 sslVerify = false from = PPBOX ROM GERRIT <[email protected]> [container] user = gerrit javaHome = /usr/lib/jvm/java-6-sun-1.6.0.26/jre [sshd] listenAddress = *:29418 [httpd] listenUrl = proxy-http://*:8081/gerrit [cache] directory = cache
$ cd /etc/apache2/mods-enabled $ ln ../mods-available/proxy.* . $ ln ../mods-available/proxy_http.* .
$ cat mods-enabled/proxy.conf <IfModule mod_proxy.c> # If you want to use apache2 as a forward proxy, uncomment the # 'ProxyRequests On' line and the <Proxy *> block below. # WARNING: Be careful to restrict access inside the <Proxy *> block. # Open proxy servers are dangerous both to your network and to the # Internet at large. # # If you only want to use apache2 as a reverse proxy/gateway in # front of some web application server, you DON'T need # 'ProxyRequests On'. #ProxyRequests On <Proxy *> AddDefaultCharset off Order deny,allow Allow from all #Allow from .example.com </Proxy> # Enable/disable the handling of HTTP/1.1 "Via:" headers. # ("Full" adds the server version; "Block" removes all outgoing Via: headers) # Set to one of: Off | On | Full | Block #ProxyVia Off ProxyPreserveHost On #AllowEncodedSlashes On ProxyPass /gerrit http://localhost:8081/gerrit nocanon </IfModule> $ cat sites-available/default <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined AllowEncodedSlashes NoDecode </VirtualHost>
$ cat /etc/apache2/httpd.conf <Location /gerrit/login/> AuthType Basic AuthName "Gerrit Code Review" Require valid-user AuthUserFile /home/gerrit/review_site/etc/gerrit.passwd </Location> $ touch /home/gerrit/review_site/etc/gerrit.passwd可能有些版本的apach2没有在apache2.conf文件中包含(Include)httpd.conf文件,需要手动添加
$ htpasswd /home/gerrit/review_site/etc/gerrit.passwd cmguo
登陆 http://192.168.13.202/gerrit/login
$ sudo apt-get install gitweb
$ tail gerrit.config user = gerrit javaHome = /usr/lib/jvm/java-6-sun-1.6.0.26/jre [sshd] listenAddress = *:29418 [httpd] listenUrl = proxy-http://*:8081/gerrit [cache] directory = cache [gitweb] cgi = /usr/lib/cgi-bin/gitweb.cgi
gitweb 需要能够访问 refs/meta/config,需要修改 All-Projects 项目,增加 Registered Users 对 refs/meta/config 的 read 访问权限。
$ htpasswd /home/gerrit/review_site/etc/gerrit.passwd isxxguo
$ cat ~/.ssh/config host ppboxrom user isxxguo hostname 192.168.13.202 port 29418 identityfile ~/.ssh/id_rsa