51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2664|回复: 0
打印 上一主题 下一主题

[转贴] CentOS配置Gerrit Gitlab Jenkins--安装Gerrit

[复制链接]

该用户从未签到

跳转到指定楼层
#
发表于 2019-3-14 17:01:12 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
1、下载Gerrit

可能需要翻墙,下载地址:https://www.gerritcodereview.com,我下载的版本是2.15.2

2、安装Gerrit

登录CentOS gerrit用户,执行java -jar gerrit-2.15.2.war inti -d /home/gerrit/gerrit_site

*** Gerrit Code Review 2.15.2
***

Create '/home/gerrit/gerrit_site' [Y/n]? y

*** Git Repositories
***

Location of Git repositories   [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]: 127.0.0.1
Server port                        [(mysql default)]:
Database name                  [reviewdb]: reviewdb
Database username            [gerrit]: gerrit
gerrit's password               :
             confirm password :

*** Index
***

Type                           [lucene/?]:

*** User Authentication
***

Authentication method          [openid/?]: http
Enable signed push support     [y/N]?

*** Review Labels
***

Install Verified label         [y/N]? y

*** Email Delivery
***

SMTP server hostname           [localhost]: smtp.XX.com
SMTP server port                   [(default)]: 465
SMTP encryption                   [none/?]: ssl
SMTP username                   : gerrit@XX.com

*** Container Process
***

Run as                         [gerrit]:
Java runtime                   [/usr/java/jdk1.8.0_144/jre]:
Copy gerrit-2.14.8.war to /home/gerrit/gerrit_site/bin/gerrit.war [Y/n]? y
Copying gerrit-2.14.8.war to /home/gerrit/gerrit_site/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]?
    Use SSL (https://)             [y/N]?
    Listen on address              

  • :
    Listen on port                   [8080]: 8008
    Canonical URL                  [http://rx_sctest5:8008/]: http://172.168.1.22:8008 // 这里我使用的是ip,也可以指定host,在发送邮件验证时候需要使用

    *** Cache
    ***


    *** Plugins
    ***

    Installing plugins.
    Install plugin commit-message-length-validator version v2.14.8 [y/N]?
    Install plugin download-commands version v2.14.8 [y/N]?
    Install plugin hooks version v2.14.8 [y/N]?
    Install plugin replication version v2.14.8 [y/N]?
    Install plugin reviewnotes version v2.14.8 [y/N]?
    Install plugin singleusergroup version v2.14.8 [y/N]?
    Initializing plugins.
    No plugins found with init steps.

    Thu May 24 15:32:33 CST 2018 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.
    Thu May 24 15:32:33 CST 2018 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/gerrit/gerrit_site
    Executing /home/gerrit/gerrit_site/bin/gerrit.sh start
    Starting Gerrit Code Review: OK
    Waiting for server on 127.0.0.1:8008 ... OK
    Opening http://127.0.0.1:8008/#/admin/projects/ ...OK

    以上安装基本结束,建议将插件全部默认安装。

    3、遇到一些问题

    问题1:Exception in thread "main" com.google.gwtorm.server.OrmException: Cannot apply SQL

    解决办法:
    使用root登录mysql,执行:set global explicit_defaults_for_timestamp=1;

    问题2:java.lang.IllegalStateException: Missing project All-Projects

    解决办法:
    删除所有表,重新安装,如果要重新安装记得删除所有表

    问题3:邮件发送失败

    解决办法:修改/home/gerrit/gerrit_site/etc/gerrit.config,添加from
    [sendemail]
        smtpServer = smtp.XX.com
        smtpServerPort = 465
        smtpEncryption = SSL
        smtpUser = gerrit@XX.com
        from = gerrit@XX.com

    4、配置gitweb

    修改/home/gerrit/gerrit_site/etc/gerrit.config

    [gitweb]
        type = gitweb
        cgi = /var/www/git/gitweb.cgi

    5、最终配置文件

    [gerrit]
        basePath = git
        serverId = 88247b5c-4339-4af7-9c69-35f75b73a1e0
        canonicalWebUrl = http://172.168.1.22:8008
    [database]
        type = mysql
        hostname = localhost
        database = gerrit
        username = gerrit
    [noteDb "changes"]
        disableReviewDb = true
        primaryStorage = note db
        read = true
        sequence = true
        write = true
    [index]
        type = LUCENE
    [auth]
        type = HTTP
    [receive]
        enableSignedPush = false
    [sendemail]
        smtpServer = smtp.XX.com
        smtpServerPort = 465
        smtpEncryption = SSL
        smtpUser = gerrit@XX.com
            from = gerrit@XX.com
    [container]
        user = gerrit
        javaHome = /usr/java/jdk1.8.0_144/jre
    [sshd]
        listenAddress = *:29418
    [httpd]
        listenUrl = proxy-http://*:8008/
    [cache]
        directory = cache
    [gitweb]
        type = gitweb
        cgi = /var/www/git/gitweb.cgi

    检验Gerrit ssh是否可用通过以下办法

    ssh -v -p 29418 admin@127.0.0.1


  • 分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-25 21:21 , Processed in 0.062803 second(s), 23 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表