Ubuntu 18.04安装gerrit 3.0.3

Ubuntu 18.04安装gerrit 3.0.3

软件环境配置安装Jdk:apt-get install openjdk-8-jre安装Apache:apt-get install apache2安装Git:apt-get gitApache配置反向代理修改文件 vi /etc/apache2/sites-available/000-default.conf<VirtualHost *:80>Se...

作者: 维特网络
分类: 技术分享
时间: 2021-12-27 18:42
阅读量: 189 次
软件环境配置
# 安装Jdk
apt-get install openjdk-8-jre

# 安装Apache
apt-get install apache2

# 安装Git
apt-get git
Apache配置反向代理
修改文件
vi /etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
ServerName 192.168.1.10
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 /home/gerrit/passwords
</Location>
AllowEncodedSlashes On
ProxyPass / http://192.168.1.10:8081/
</VirtualHost>
Apache配置 开启SSL、Proxy、Rewrite等模块
cd /etc/apache2/mods-enabled/
ln -s ../mods-available/proxy.load
ln -s ../mods-available/proxy.conf
ln -s ../mods-available/proxy_http.load
ln -s ../mods-available/proxy_balancer.conf
ln -s ../mods-available/proxy_balancer.load
ln -s ../mods-available/rewrite.load
ln -s ../mods-available/ssl.conf
ln -s ../mods-available/ssl.load
ln -s ../mods-available/slotmem_shm.load
ln -s ../mods-available/socache_shmcb.load
创建用户数据文件
# 创建首次登陆管理员用户
htpasswd -cb /home/gerrit/passwords admin admin

# 创建其他用户
htpasswd -b /etc/httpd/passwords test test
Gerrit安装与配置
在gerrit安装目录 /home/gerrit 执行:
java -jar gerrit-3.0.3.war init

# gerrit下载地址
https://gerrit-releases.storage.googleapis.com/gerrit-3.0.3.war
重要设置
Authentication method [openid/?]: HTTP
Behind reverse proxy [y/N]? y
Listen on port [8081]:
Canonical URL http://192.168.1.10:8081/
启动gerrit
/home/gerrit/bin/gerrit.sh start