直接安装11的
sudo apt-get update
sudo apt list | grep jdk
sudo apt install openjdk-11-jdk
sudo apt install git
sudo apt-get install apache2
sudo vim /etc/apache2/httpd.conf
ServerName localhost
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
Order deny,allow
Allow from all
AuthType Basic
AuthName "Gerrit Code Review"
Require valid-user
AuthBasicProvider file
AuthUserFile /home/gerrit/review_site/passwords
AllowEncodedSlashes On
ProxyPass / http://127.0.0.1:8091/ nocanon
将httpd.conf添加到apache2.conf中
sudo vi /etc/apache2/apache2.conf
添加:
#Include list of ports to listen on
Include ports.conf
Include httpd.conf
修改配置文件,添加对8081端口的监听:
sudo vi /etc/apache2/ports.conf
添加:
Listen 8081
开启SSL、Proxy、Rewrite等模块:
cd /etc/apache2/mods-enabled/
sudo ln -s ../mods-available/proxy.load
sudo ln -s ../mods-available/proxy.conf
sudo ln -s ../mods-available/proxy_http.load
sudo ln -s ../mods-available/proxy_balancer.conf
sudo ln -s ../mods-available/proxy_balancer.load
sudo ln -s ../mods-available/rewrite.load
sudo ln -s ../mods-available/ssl.conf
sudo ln -s ../mods-available/ssl.load
sudo ln -s ../mods-available/slotmem_shm.load
sudo ln -s ../mods-available/socache_shmcb.load
gerrit下载链接:Gerrit 代码审查 |Gerrit 代码审查 (gerritcodereview.com)
root
用户$ su - root
root
用户添加可写权限chmod 640 /etc/sudoers
sudoers
文件# vim /etc/sudoers
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-dzF38lIF-1689922057903)(C:\Users\冯有凯\AppData\Roaming\Typora\typora-user-images\image-20230707122106405.png)]
如上图所示位置加上’gerrit ALL=(ALL) ALL’后,按下esc
键,输入:wq
保存修改并退出编辑。
sudoers
文件:只读权限(原有权限)# chmod 440 /etc/sudoers
sudo
命令验证# exit
sudo adduser gerrit
sudo su gerrit
mkdir Gerrit
java -jar gerrit.war init -d ./Gerrit
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4mBVQnx2-1689922057903)(C:\Users\冯有凯\AppData\Roaming\Typora\typora-user-images\image-20230707143217687.png)]
一路回车点到最后
vim ~/review_site/etc/gerrit.config
[gerrit]
basePath = git
canonicalWebUrl = http://localhost.localdomain:8081/
serverId = 362064bc-c4a0-4215-bf14-ff9508e7e955
[container]
javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
user = gerrit
javaHome = /usr/lib/jvm/java-11-openjdk-amd64
[index]
type = lucene
[auth]
type = HTTP
userNameCaseInsensitive = true
[receive]
enableSignedPush = false
[sendemail]
smtpServer = localhost
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = proxy-http://*:8091/
[cache]
directory = cache
[gitweb]
type = gitweb
cgi = /usr/lib/cgi-bin/gitweb.cgi
touch ~/Gerrit/passwords
sudo htpasswd -b ~/review_site/passwords admin password
sudo apt-get install gitweb
sudo ~/Gerrit/bin/gerrit.sh restart
sudo /etc/init.d/apache2 restart
iew_site/passwords admin password
#### 5.安装gitweb
```shell
sudo apt-get install gitweb
sudo ~/Gerrit/bin/gerrit.sh restart
sudo /etc/init.d/apache2 restart
参考链接https://blog.csdn.net/qq_37793601/article/details/122279357