我花了一段时间才弄明白。
Tomcat 已安装并测试。
然后我把gerrit war文件复制过来,放到tomcat/webapps中。然后从tomcat管理器 http://[host]:8080/manager/ 我安装了它(通过点击开始按钮)
然后我必须安装 mysql J 连接器。基本上是从Mysql下载,然后把jar文件复制到tomcat/lib中
接下来我在 tomcat/webapps/gerrit/META-INF 中创建了一个名为 Context.xml 的文件
<Context>
<Resource name="jdbc/ReviewDb" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="****" password="******" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/reviewdb"/>
</Context>
因为我在守护进程中使用了充气城堡,所以我不得不将 .jar 文件从原始安装复制到 tomcat/webapps/gerrit/WEB-INF/lib
然后我设法启动 gerrit 看看它是否工作。尝试访问 http://[host]:8080/gerrit 这应该会给您一个来自 gerrit 的错误,提示您 Apache conf 错误。
然后我像这样重新配置了我的 apache 虚拟主机。所以我用http://gerrit/gerrit访问gerrit
然后在将您的请求传递到 tomcat 服务器之前使用 http auth。
<VirtualHost *:80>
ServerAdmin adrian@iceweasel
ServerName gerrit
ServerAlias gerrit
ErrorLog "logs/error_log"
CustomLog "logs/access_log" vcommon
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location /gerrit/login/>
AuthType Basic
AuthName "Gerrit Code Review"
AuthUserFile /rddata/www/gerrit/users
AuthGroupFile /rddata/www/gerrit/groups
Require group review
Order Deny,Allow
Allow from all
</Location>
ProxyPass /gerrit/ http://127.0.0.1:8080/gerrit/
</VirtualHost>