搭建了一下gerrit的环境,主要参考了
http://blog.sina.com.cn/s/blog_7a691e910101jc51.html
下的过程
其中遇到了一些问题,记录一下
1.数据库选择mysql,安装中默认下载的版本号为5.1,跟我电脑上的的8.0版本不配套。
2.尝试自己下载驱动并替换 解决上面问题,但是执行某条sql时发现有关键字group与mysql冲突,于是手动执行该sql ,顺利建表
3.后续有反向代理的配置问题,使用了mac系统自带的apache2
4.在启动之后顺利登陆,但是邮件配置出现问题,无法发送至邮箱,避免麻烦直接修改了数据库,accounts以及account_external_ids两张表,但是修改后需要重启服务,否则页面不会更新。
5.在执行到创建项目等步骤时,依然发生的数据库sql执行失败,这时反应过来,联想到之前遇到的建表问题,估计是数据库版本没对上,于是把mysql版本降到5,成功执行完成。
apache2的配置
使用了系统自带的apache2
路径/etc/apache2
需要修改httpd.conf,末尾添加配置
需要注意
AuthUserFile需要和对应的文件匹配上,创建过程网上很多可以查到
ProxyPass需要和gerrit中的配置对应上
启动命令为sudo apachectl -k restart/start/stop
<VirtualHost 127.0.0.1:80>
ServerName 127.0.0.1
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location /gerrit/login/>
AuthType Basic
AuthName "Gerrit Code Review"
Require valid-user
AuthUserFile /etc/apache2/passwords
</Location>
AllowEncodedSlashes On
ProxyPass /gerrit http://127.0.0.1:8081/gerrit
</VirtualHost>
以下是具体的安装过程
mqc@mqcdeMBP bin % java -jar /Users/mqc/Desktop/gerrit-2.13.13.war init -d /Users/mqc/Desktop/gerrit2/review_site
Using secure store: com.google.gerrit.server.securestore.DefaultSecureStore
*** Gerrit Code Review 2.13.13
*** Git Repositories
Location of Git repositories [git]:
*** SQL Database
Database server type [mysql]:
Gerrit Code Review is not shipped with MySQL Connector/J 5.1.21
** This library is required for your configuration. **
Download and install it now [Y/n]? n
Server hostname [127.0.0.1]:
Server port [(mysql default)]:
Database name [reviewdb]:
Database username [gerrit2]:
Change gerrit2’s password [y/N]?
*** User Authentication
Authentication method [HTTP/?]:
Get username from custom HTTP header [y/N]?
SSO logout URL :
Enable signed push support [y/N]?
*** Review Labels
Install Verified label [y/N]?
*** Email Delivery
SMTP server hostname [smtp.qq.com]:
SMTP server port [465]:
SMTP encryption [NONE/?]:
SMTP username [1547791192@qq.com]:
Change 1547791192@qq.com’s password [y/N]?
*** Container Process
Run as [mqc]:
Java runtime [/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre]:
Upgrade /Users/mqc/Desktop/gerrit2/review_site/bin/gerrit.war [Y/n]?
Copying gerrit-2.13.13.war to /Users/mqc/Desktop/gerrit2/review_site/bin/gerrit.war
*** SSH Daemon
Listen on address [*]:
Listen on port [29418]:
*** HTTP Daemon
Behind reverse proxy [Y/n]?
Proxy uses SSL (https://) [y/N]?
Subdirectory on proxy server [/gerrit]:
Listen on address [127.0.0.1]:
Listen on port [8081]:
Canonical URL [http://127.0.0.1/gerrit]:
*** Cache
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/mergeability.lock.db [y/N]?
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/diff_intraline.lock.db [y/N]?
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/web_sessions.lock.db [y/N]?
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/git_tags.h2.db [y/N]?
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/diff.h2.db [y/N]?
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/oauth_tokens.lock.db [y/N]?
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/oauth_tokens.h2.db [y/N]?
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/change_kind.lock.db [y/N]?
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/diff_intraline.h2.db [y/N]?
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/conflicts.lock.db [y/N]?
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/git_tags.lock.db [y/N]?
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/conflicts.h2.db [y/N]?
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/mergeability.h2.db [y/N]?
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/diff.lock.db [y/N]?
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/change_kind.h2.db [y/N]?
Delete cache file /Users/mqc/Desktop/gerrit2/review_site/cache/web_sessions.h2.db [y/N]?
*** Plugins
Installing plugins.
Install plugin commit-message-length-validator version v2.13.13 [Y/n]?
commit-message-length-validator v2.13.13 is already installed, overwrite it [Y/n]?
Updated commit-message-length-validator to v2.13.13
Install plugin download-commands version v2.13.13 [Y/n]?
download-commands v2.13.13 is already installed, overwrite it [Y/n]?
Updated download-commands to v2.13.13
Install plugin hooks version v2.13.13 [Y/n]?
hooks v2.13.13 is already installed, overwrite it [Y/n]?
Updated hooks to v2.13.13
Install plugin replication version v2.13.13 [Y/n]?
replication v2.13.13 is already installed, overwrite it [Y/n]?
Updated replication to v2.13.13
Install plugin reviewnotes version v2.13.13 [Y/n]?
reviewnotes v2.13.13 is already installed, overwrite it [Y/n]?
Updated reviewnotes to v2.13.13
Install plugin singleusergroup version v2.13.13 [Y/n]?
singleusergroup v2.13.13 is already installed, overwrite it [Y/n]?
Updated singleusergroup to v2.13.13
Initializing plugins.
No plugins found with init steps.
Tue May 12 14:58:07 CST 2020 WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue May 12 14:58:08 CST 2020 WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.