下載軟體:
git-1.8.1.5.tar.gz
http://code.google.com/p/git-core/downloads/detail?name=git-1.8.1.5.tar.gz&can=2&q=
httpd-2.0.64.tar.gz
http://mirror.bit.edu.cn/apache//httpd/
gerrit-full-2.5.2.war
軟體都拷貝到
/usr/soft目錄下
安裝git
[root@GBase git-1.8.1.5]# tar -xzf git-1.8.1.5.tar.gz
[root@GBase git-1.8.1.5]# cd git-1.8.1.5
[root@GBase git-1.8.1.5]# make prefix=/usr/local all
[root@GBase git-1.8.1.5]# make prefix=/usr/local install
安裝完成後輸入git,有反饋即成功
安裝apache服務
[root@GBase apache]# tar -xvzf httpd-2.0.64.tar.gz
[root@GBase apache]# cd httpd-2.0.64
[root@GBase apache]# ./configure --prefix=/usr/soft/apache --enable-mods-shared='proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http proxy_rewrite'
[root@GBase apache]# make
[root@GBase apache]# make install
安裝完成
查看80連接埠是否被佔用,沒被佔用直接使用,佔用修改連接埠
netstat -tln | grep 80
netstat -tln | grep 8080
編輯apache設定檔
vi httpd.conf
在末尾添加如下配置
<VirtualHost *:80>
ServerName Gitserver
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
<Proxy *:80>
Order deny,allow
Allow from all
</Proxy>
<Location /login/>
AuthType Basic
AuthName "Gerrit Code Review"
Require valid-user
AuthUserFile /usr/soft/git/htpasswd
</Location>
ProxyPass / http://10.14.132.204:9080/
ProxyPassReverse / http://10.14.132.204:9080/
</VirtualHost>
安裝gerrit
java -jar gerrit.war init -d /usr/soft/gerrit
[root@GBase soft]# java -jar gerrit-full-2.5.2.war init -d /usr/soft/gerrit
*** Gerrit Code Review 2.5.2
***
Create '/usr/soft/gerrit' [Y/n]? Y
*** 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 : logout
*** Email Delivery
***
SMTP server hostname [localhost]:
SMTP server port [(default)]:
SMTP encryption [NONE/?]:
SMTP username :
*** Container Process
***
Run as [root]:
Java runtime [/usr/local/jdk1.6.0_38/jre]:
Copy gerrit.war to /usr/soft/gerrit/bin/gerrit.war [Y/n]?
Copying gerrit.war to /usr/soft/gerrit/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]? n
Generating SSH host key ... rsa(simple)... done
*** HTTP Daemon
***
Behind reverse proxy [y/N]?
Use SSL (https://) [y/N]?
Listen on address [*]:
Listen on port [8080]: 9080
*** Plugins
***
Prompt to install core plugins [y/N]?
Initialized /usr/soft/gerrit
Executing /usr/soft/gerrit/bin/gerrit.sh start
Starting Gerrit Code Review: OK
Waiting for server to start ... OK
Opening browser ...
下一步停止gerrit服務,然後進行配置
可以通過命令[root@GBase bin]# ps -ef | grep gerrit 查看到已經啟動並執行gerrit進程
[root@GBase bin]# ./gerrit.sh stop
** ERROR: GERRIT_SITE not set
遇到上面的錯誤資訊,編輯
gerrit.sh
添加
GERRIT_SITE=/usr/soft/gerrit
編輯gerrit.config
[root@GBase etc]# vi gerrit.config
[gerrit]
basePath = git
canonicalWebUrl = http://10.14.132.204:9080/
[database]
type = H2
database = db/ReviewDB
[auth]
type = HTTP
logoutUrl = http://aa:aa@10.14.132.204/
[sendemail]
smtpServer = smtp.163.com
smtpUser = manager@163.com
smtpPass = manager
from = manager@163.com
[container]
user = root
javaHome = /usr/local/jdk1.6.0_38/jre
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = http://10.14.132.204:9080/
[cache]
directory = cache
apache啟動和停止
啟動apache2:
[root@GBase bin]# ./apachectl start
停止apache2:
[root@GBase bin]# ./apachectl stop
設定apache和gerrit自動啟動
編輯 /etc/rc.d/rc.local
將執行命令添加到這個檔案中
/usr/soft/apache/bin/apachectl start
/usr/soft/gerrit/bin/gerrit.sh start