Gerrit安装

1. Gerrit安装之前mysql的准备工作              

       1.由于gerrit,我决定使用mysql数据库,所以要对配置进行修改以及。
                   Gerrit使用mysql的问题解决:http://blog.csdn.net/nwpushuai/article/details/79250379
      2.创建mysql数据库
                         create database gerrit CHARACTER SET utf8 COLLATE utf8_general_ci;
                    grant all on gerrit.* to 'nwpushuai'@'localhost' identified by '密码';



2.Gerrit安装之前Apache2的准备工作

 

 

gerrit的war文件下载地址:https://gerrit-releases.storage.googleapis.com/ 

 

 

下载时请下载对应版本的war文件,例如:https://gerrit-releases.storage.googleapis.com/gerrit-2.15.war 

由于要使用Apache2的反向代理功能,所以需要对Apache2进行配置

      
       1.开启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;

                sudo ln -s ../mods-available/cgid.load;

                sudo ln -s ../mods-available/cgi.load;
          2.修改配置文件:   
                   sudo vi /etc/apache2/gerrit-httpd.conf
    
                     <VirtualHost *:8081>
                         ServerName IP地址

                         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/nwpushuai/SoftWare/Gerrit/gerrit/etc/passwords
                         </Location>

                         AllowEncodedSlashes On

                         ProxyPass / http://ip地址:8091/ nocanon

                     </VirtualHost>
                     注:如httpd.conf没有Include到apache2.conf中,需手动添加:
                     sudo vi /etc/apache2/apache2.conf
                     添加:  Include gerrit-httpd.conf

                     修改配置文件,添加对8081端口的监听:
                     sudo vi /etc/apache2/ports.conf
                     添加:  Listen 8081

3. Gerrit安装过程nwpushuai@nwpushuai:~/SoftWare/Gerrit$ java -jar gerrit.war init -d gerrit
Using secure store: com.google.gerrit.server.securestore.DefaultSecureStore
[2017-10-16 22:32:17,548] [main] INFO  com.google.gerrit.server.config.GerritServerConfigProvider : No /home/nwpushuai/SoftWare/Gerrit/gerrit/etc/gerrit.config; assuming defaults

*** Gerrit Code Review 2.14.3
*** 

Create '/home/nwpushuai/SoftWare/Gerrit/gerrit' [Y/n]? y

*** Git Repositories
*** 

Location of Git repositories   [git]: #这里一定要写git放的目录,没有的话自己会创建的

*** SQL Database
*** 

Database server type           [h2]: mysql #数据库配置

Gerrit Code Review is not shipped with MySQL Connector/J 5.1.41
**  This library is required for your configuration. **
Download and install it now [Y/n]? y
Downloading https://repo1.maven.org/maven2/m ... tor-java-5.1.41.jar ... OK
Checksum mysql-connector-java-5.1.41.jar OK
Server hostname                [localhost]: localhost 
Server port                    [(mysql default)]: 3306
Database name                  [reviewdb]: gerrit
Database username              [nwpushuai]: nwpushuai
nwpushuai's password           : 
              confirm password : 

*** Index
*** 

Type                           [LUCENE/?]: #默认就好,直接回车

*** User Authentication
*** 

Authentication method          [OPENID/?]: http        #认证方式,一定要写http,不然就不是反向代理了,写development_become_any_account就随意登陆了
Get username from custom HTTP header [y/N]? n          #一定要n,不然反向代理gerrit报错为缺少一个y的header
SSO logout URL                 : 
Enable signed push support     [y/N]? n

*** Review Labels
*** 

Install Verified label         [y/N]? y

*** Email Delivery
*** 

SMTP server hostname           [localhost]: smtp.163.com  # 25端口是163的smtp
SMTP server port               [(default)]: 25
SMTP encryption                [NONE/?]: 
SMTP username                  [nwpushuai]: ××××××××××@163.com
××××××××××@163.com's password : 
              confirm password : 

*** Container Process
*** 

Run as                         [nwpushuai]: 
Java runtime                   [/usr/lib/jvm/java-8-openjdk-amd64/jre]: 
Copy gerrit.war to gerrit/bin/gerrit.war [Y/n]? y
Copying gerrit.war to gerrit/bin/gerrit.war

*** SSH Daemon
*** 

Listen on address             : 
Listen on port                 [29418]: 
Generating SSH host key ... rsa... dsa... ed25519... ecdsa 256... ecdsa 384... ecdsa 521... done

*** HTTP Daemon
*** 

Behind reverse proxy           [y/N]? y
Proxy uses SSL (https://)      [y/N]? n
Subdirectory on proxy server   [/]: 
Listen on address             : 
Listen on port                 [8081]: 
Canonical URL                  [http://nwpushuai/]: 

*** Cache
*** 


*** Plugins
*** 

Installing plugins.
Install plugin commit-message-length-validator version v2.14.3 [y/N]? y
Installed commit-message-length-validator v2.14.3
Install plugin download-commands version v2.14.3 [y/N]? y
Installed download-commands v2.14.3
Install plugin hooks version v2.14.3 [y/N]? y
Installed hooks v2.14.3
Install plugin replication version v2.14.3 [y/N]? y
Installed replication v2.14.3
Install plugin reviewnotes version v2.14.3 [y/N]? y
Installed reviewnotes v2.14.3
Install plugin singleusergroup version v2.14.3 [y/N]? y
Installed singleusergroup v2.14.3
Initializing plugins.

Mon Oct 16 22:36:13 CST 2017 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.
Mon Oct 16 22:36:13 CST 2017 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.
Initialized /home/nwpushuai/SoftWare/Gerrit/gerrit
Executing /home/nwpushuai/SoftWare/Gerrit/gerrit/bin/gerrit.sh start
Starting Gerrit Code Review: OK
Waiting for server on nwpushuai:80 ... OK
Opening http://nwpushuai/#/admin/projects/ ...OK

gerrit的配置文件详解
http://blog.csdn.net/nwpushuai/article/details/79250396
创建HTTP认证用户

 

首次创建可以加-c参数,用于创建此文件,后来的不需要

 

htpasswd命令详解:http://man.linuxde.net/htpasswd

请使用CRYPT算法对密码进行加密,方便后续的修改(

htpasswd.cgi 网页远程修改gerrit ht 认证的密码文件:https://blog.csdn.net/nwpushuai/article/details/80209492

sudo htpasswd -cbd /home/nwpushuai/SoftWare/Gerrit/gerrit/etc/passwords nwpushuai nwpushuai   #nwpushuai 第一个为用户名,第二个为用户密码
sudo htpasswd -bd /home/nwpushuai/SoftWare/Gerrit/gerrit/etc/passwords nwpushuai1 nwpushuai1   #nwpushuai1 第一个为用户名,第二个为用户密码

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值