CentOS下Gerrit部署

参考文档:https://www.cnblogs.com/yinzhengjie/p/11007383.html

1、JDK环境部署

  • 解压jdk-8u231-linux-x64.tar.gz到/home/opt/jdk下
  • 将jdk路径配置到系统路径下
    • sudo vim /etc/profile
    • # add jdk path
    • export JAVA_HOME=/home/opt/jdk/jdk1.8.0_231
    • export PATH=$JAVA_HOME/bin:$PATH
  • 退出当前终端后重新打开终端

2、Git环境部署

  • 卸载原有的Git
    • sudo yum -y remove git
  • 安装Git
    • sudo yum install -y gitweb
    • sudo yum -y install epel-release
    • sudo yum install -y git-review
    • sudo yum -y install wget
    • wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.12.2.tar.gz
    • sudo yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
    • mkdir -p /home/opt/git; tar -xvf git-2.12.2.tar.gz; cd git-2.12.2; sudo su
    • ./configure prefix=/home/opt/git/git-2.12.2
    • make && make install
  • 将Git路径配置到系统路径下
    • sudo vim /etc/profile
    • # add git path
    • export GIT_HOME=/home/opt/git/git-2.12.2
    • export PATH=$GIT_HOME/bin:$PATH
  • 退出当前终端后重新打开终端
  • 配置Git
    • git config --global user.name "wenfei6316"
    • git config --global user.email "wenfei6316@163.com"
    • git config --global color.ui true

3、Apache服务器部署

  • sudo yum -y install httpd
  • sudo systemctl start httpd
  • sudo systemctl enable httpd
  • sudo systemctl status httpd

4、Gerrit环境部署

  • 下载gerrit-3.0.0.war
  • 创建gerrit用户
    • sudo useradd gerrit
    • sudo passwd gerrit
    • sudo vim /etc/sudoers
    • 102 行添加:gerrit  ALL=(ALL)       ALL
  • 安装gerrit
    • java -jar gerrit-3.0.0.war init -d review_site
    • 每一步的设置配置
      • Create '/home/gerrit/review_site' [Y/n]? Y
      • Location of Git repositories   [git]:
      • Type                           [lucene/?]:
      • Authentication method          [openid/?]: http
      • Get username from custom HTTP header [y/N]?
      • SSO logout URL                 :
      • Enable signed push support     [y/N]?
      • Install Verified label         [y/N]?
      • SMTP server hostname           [localhost]:
      • SMTP server port               [(default)]:
      • SMTP encryption                [none/?]:
      • SMTP username                  :
      • Run as                         [gerrit]:
      • Java runtime                   [/home/opt/jdk1.8.0_231/jre]:/home/opt/jdk/jdk1.8.0_231/jre
      • Listen on address              [*]:
      • Listen on port                 [29418]:
      • Behind reverse proxy           [y/N]?
      • Use SSL (https://)             [y/N]?
      • Listen on address              [*]:
      • Listen on port                 [8080]:
      • Canonical URL                  [http://localhost:8080/]:
      • Install plugin codemirror-editor version v3.0.0 [y/N]?
      • Install plugin commit-message-length-validator version v3.0.0 [y/N]?
      • Install plugin delete-project version v3.0.0 [y/N]?
      • Install plugin download-commands version v3.0.0 [y/N]?
      • Install plugin gitiles version v3.0.0 [y/N]?
      • Install plugin hooks version v3.0.0 [y/N]?
      • Install plugin plugin-manager version v3.0.0 [y/N]?
      • Install plugin replication version v3.0.0 [y/N]?
      • Install plugin reviewnotes version v3.0.0 [y/N]?
      • Install plugin singleusergroup version v3.0.0 [y/N]?
      • Install plugin webhooks version v3.0.0 [y/N]?
    • 配置结束出现:

 

  • 创建gerrit用户
    • sudo htpasswd -cb /etc/httpd/passwords admin admin
    • sudo htpasswd -b /etc/httpd/passwords wenfei wenfei6316
  • 设置Apache的反向代理
    • vim /etc/httpd/conf/httpd.conf

Listen 9090

<VirtualHost *:9090>

    ServerName 192.168.0.103

    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

        AuthUserFile /etc/httpd/passwords

    </Location>

    AllowEncodedSlashes On

    ProxyPass / http://192.168.0.103:8080/

</VirtualHost>

  • sudo systemctl restart httpd
  • 登陆gerrit

打开firefox输入网址:http://localhost:9090或http://192.168.0.103:9090出现以下表示部署成功

 

问题解决:

1、打开网页出现如下时解决办法

解答方法:gerrit需要使用反响代理,执行创建gerrit用户和设置Apache的反向代理即可

2、执行sudo systemctl restart httpd出现如下

解答方法:

执行sudo systemctl status httpd出现

执行sudo setenforce 0

执行sudo systemctl start httpd和sudo systemctl status httpd均OK

参考https://blog.youkuaiyun.com/weixin_43557605/article/details/99289599

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值