1、update
2、updategrale
一:安装前准备
配置管理gerrit的专属账号:(本次测试安装我用的ROOT)
sudo adduser gerrit
sudo usermod -a -G sudo gerrit //分配sudo 权限
sudo su gerrit
java、git环境:
sudo apt-get update
sudo apt-get install openjdk-16-jdk
sudo apt-get install git
二:Apache2安装和配置
sudo apt-get install apache2
cd /etc/apache2
创建httpd.conf
sudo touch /etc/apache2/httpd.conf
sudo vi httpd.conf
文件写入以下内容:
*注意反射代理的端口号和实际gerrit试用的端口不一样,本文实际使用8080作为gerrit的端口号,8091作为反射代理的端口号
<VirtualHost *:8080>
#这里是反射代理的端口号,
ServerName 10.20.26.45
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 /mnt/data/review_site/passwords
#这个路径是gerrit账户密码管理,后续的步骤中会创建此文件。路径有写正确
</Location>
AllowEncodedSlashes On
ProxyPass / http://10.20.26.45:8091/
ProxyPassReverse / http://10.20.26.45:8091/
</VirtualHost>