Gerrit安装需要注意的点
1.注意jdk的版本(我选用jdk8)
2.设置好代理配置(apache或者nginx)
gerrit.config配置:
[gerrit]
basePath = git
serverId = 0c7ed3f1-6236-4a2b-a9ba-cd0ddec32092
canonicalWebUrl = http://192.168.245.131:8090
[database]
type = h2
database = /home/zb/review_site/db/ReviewDB
[noteDb "changes"]
disableReviewDb = true
primaryStorage = note db
read = true
sequence = true
write = true
[container]
user = zb
javaHome = /home/zb/jdk/jdk1.8.0_211
[index]
type = LUCENE
[auth]
type = HTTP
[receive]
enableSignedPush = false
[sendemail]
smtpServer = mail.100fen.cn
smtpServerPort = 25
smtpUser = 18269783010@100fen.cn
from=CodeReview18269783010@100fen.cn
[sshd]
listenAddress = :29418
[httpd]
listenUrl = proxy-http://:8080/
[cache]
directory = cache
apache中000-default.conf配置:
<VirtualHost *:8090>
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location /login/>
AuthType Basic
AuthName "Welcome to Gerrit Code Review Site!"
Require valid-user
AuthUserFile /home/zb/review_site/gerrit.password
</Location>
AllowEncodedSlashes On
ProxyPass / http://127.0.0.1:8080/
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
在000-default.conf同目录新建一个gerrit-httpd.conf文件
配置主机ip:ServerName 192.168.245.131
apache中ports.conf配置:
NameVirtualHost *:80
NameVirtualHost *:8090
Listen 80
Listen 8090
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
在review_site目录下新建一个gerrit.password文件用来存放用户名和密码
gerrit添加新用户 htpasswd -c gerrit.password admin(在review_site目录下输入,就创建了一个用户名为admin的账户)
之后添加用户只需要把-c改为-m即可(记住要把所有用户名改成自己的,上面例子配置的用户名为zb)
服务器输入:./review_site/bin/gerrit.sh start(启动gerrit) systemctl start apache2.service (启动apache服务)
浏览器输入:http://192.168.245.131:8090 即可访问 输入创建好的用户名和密码即可登录
按照这样配置192.168.245.131要改成自己的虚拟主机ip
经过上面操作应该可以访问gerrit,但是要想同一局域网下的所有电脑都能访问则需要把虚拟机网络ip设置成与该局域网下的网段相同(设置详情见学习文件的文件夹中)。还完网段之后,要把Gerrit登陆网址设置成改变后的网络ip,端口号不变,访问这个网络ip加端口号即可。