- 安装openjdk 7
# apt-get install openjdk-7-jdk
- 安装apache2
# apt-get install apache2
- 安装PostgreSQL数据库
# apt-get install postgresql
# passwd postgres (修改postgres密码,默认为:postgres)
# su -postgres
$ createuser --username=postgres –RDIElPS gerrit2 (“l”为字母)
$ createdb --username=postgres -E UTF-8 -O gerrit2reviewdb (“O”为大写字母)
- 安装配置gerrit
下载网址:https://gerrit-releases.storage.googleapis.com/gerrit-2.11.war
安装和配置:
$java -jar gerrit.war init -d review_site
Create ‘/home/zhi.yang/review_site‘[Y/n]? y ---------------创建review_site文件夹
Location of Gitrepositories [git]:
Database servertype [H2/?]: postgresql ---------------数据库的类型选择postgresql
Gerrit Code Reviewis not shipped with MySQL Connector/J 5.1.10
** This library is required for yourconfiguration. **
Download and installit now [Y/n]? y ---------下载并安装与mysql相关的lib库
Usemysql-connector-java-5.1.10.jar anyway [y/n]? y
Serverhostname [localhost]:
Server port [(postgresql default)]:
Database name [reviewdb]: ----数据库的名字为reviewdb,直接回车
Databaseusername [gerrit2]: ----数据库的用户为gerrit2,直接回车
gerrit2‘spassword : -----输入gerrit2的密码。此处gerrit2的密码要与ubuntu系统的密码区分开,此处输入的密码应该是在数据库中gerrit2用户的密码(123)
Authenticationmethod [OPENID/?]: ldap-----------选择用户认证方式
LDAP server [ldap://localhost]:ldap://10.0.0.9:3268
LDAP username : gerrit
gitserver‘s password : ******
confirm password : ******
Account BaseDN [DC=0,DC=0,DC=98:3268]: DC=ming,DC=com
Group BaseDN [DC=ming,DC=com]:
Install Verifiedlabel [y/N]?
SMTP serverhostname [localhost]:
SMTP serverport [(default)]:
SMTPencryption [NONE/?]:
SMTP username :
Run as [zhi.yang]:
Java runtime [/usr/lib/jvm/java-7-openjdk-amd64/jre]:
Copy gerrit.war to/home/gerrit2/review_site/bin/gerrit.war [Y/n]?
Listen onaddress [*]:
Listen on port [29418]:
Gerrit Code Reviewis not shipped with Bouncy Castle Crypto v144
If available, Gerrit can take advantage offeatures
in the library, but will also functionwithout it.
Download andinstall it now [Y/n]?
Press enter tocontinue
Continue withoutthis library [Y/n]?
Behind reverseproxy [y/N]?
Use SSL(https://) [y/N]?
Listen onaddress [*]:
Listen on port [8080]:
Canonical URL [http://archivebak.ming.com:8080/]:
Install plugindownload-commands version v2.11 [y/N]?
Install pluginreviewnotes version v2.11 [y/N]?
Install pluginsingleusergroup version v2.11 [y/N]?
Install pluginreplication version v2.11 [y/N]?
Install plugincommit-message-length-validator version v2.11 [y/N]?
Initialized/home/zhi.yang/review_site
启动、关闭、重启gerrit
$ ./review_site/bin/gerrit.sh start/stop/restart
- 访问:
注:
如不想使用8080端口,到~/review_site/etc/gerrit.config里改下,然后重启gerrit即可(不过安装时建议用默认的8080,装完再改)