安装java18 sudo apt-get install openjdk-18-jdk
安装apache2 sudo apt-get install apache2
安装gerrit java -jar gerrit-3.7.0.war init -d /gerrit_path
修改apache2 vim /etc/apache2/sites-available/000-default.conf
启动apache2 sudo /etc/init.d/apache2 restart
启动失败log:
Invalid command ‘ProxyRequests’, perhaps misspelled or defined by a module not included in the server configuration
执行:
sudo ln -s /etc/apache2/mods-available/proxy.conf /etc/apache2/mods-enabled/proxy.conf
sudo ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled/proxy.load
sudo ln -s /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled/proxy_http.load
再次重启apache2正常
启动gerrit
sudo bin/gerrit.sh start
com.google.gerrit.server.config.GitwebCgiConfig : gitweb not installed (no /usr/lib/cgi-bin/gitweb.cgi found)
org.eclipse.jetty.util.log : Logging initialized @4793ms to org.eclipse.jetty.util.log.Slf4jLog
备注
安装gitweb后使用 gerrit.sh start命令仍然启动失败,且没有相应log可以查看。改用run运行成功。
因此,gitweb是否必须待定,可以帮忙跳过验证。
安装gitweb sudo apt-get install gitweb
以下安装我没有选择重启系统或service,都是按了ESC退出,并不影响安装。
查看启动log sudo ./gerrit.sh run & (后台启动)
解决对应的错误问题(我这里是sendemail的设置多加了from设置导致启动失败)
附 000-default.conf 和 gerrit.config部分内容
/etc/apache2/sites-available/000-default.conf
ServerName localhost
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 /gerrit_path/etc/passwords
</Location>
AllowEncodedSlashes On
ProxyPass / http://192.168.X.X:8081/ nocanon
gerrit_path/etc/gerrit.config
[gerrit]
basePath = git
canonicalWebUrl = http://192.168.X.X/
serverId =
[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 =
javaHome = /usr/lib/jvm/java-18-openjdk-amd64
[index]
type = lucene
[auth]
type = HTTP
userNameCaseInsensitive = true
[receive]
enableSignedPush = false
[sendemail]
enable = true
smtpServer =
smtpServerPort =
smtpUser =
smtpPass =
from =
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = http://192.168.X.X:8081/
[cache]
directory = cache
启动命令:nohup gerrit.sh run &