gerrit的安装

gerrit的安装

1.jdk

直接安装11的

sudo apt-get update
sudo apt list | grep jdk
sudo apt install openjdk-11-jdk

2.安装git

sudo apt install git

3.安装apache2

sudo apt-get install apache2

sudo vim /etc/apache2/httpd.conf


    ServerName localhost

    ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On

    
          Order deny,allow
          Allow from all
    

    
        AuthType Basic
        AuthName "Gerrit Code Review"
        Require valid-user
        AuthBasicProvider file
        AuthUserFile /home/gerrit/review_site/passwords
    

    AllowEncodedSlashes On

    ProxyPass / http://127.0.0.1:8091/ nocanon

将httpd.conf添加到apache2.conf中

sudo vi /etc/apache2/apache2.conf

添加:

#Include list of ports to listen on

Include ports.conf
Include httpd.conf

修改配置文件,添加对8081端口的监听:

sudo vi /etc/apache2/ports.conf

添加:

Listen 8081

开启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

4.安装配置gerrit

gerrit下载链接:Gerrit 代码审查 |Gerrit 代码审查 (gerritcodereview.com)

gerrit的安装_第1张图片

可能会遇到的问题

用户 不在 sudoers 文件中。此事将被报告。

  • 切换至root用户
$ su - root
  • root用户添加可写权限
chmod 640 /etc/sudoers
  • 修改sudoers文件
# vim /etc/sudoers

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-dzF38lIF-1689922057903)(C:\Users\冯有凯\AppData\Roaming\Typora\typora-user-images\image-20230707122106405.png)]

如上图所示位置加上’gerrit ALL=(ALL) ALL’后,按下esc键,输入:wq保存修改并退出编辑。

  • 修改sudoers文件:只读权限(原有权限)
# chmod 440 /etc/sudoers
  • 普通用户继续使用sudo命令验证
# exit

上述操作完成后

  sudo adduser gerrit
  sudo su gerrit
  mkdir Gerrit
  java -jar gerrit.war init -d ./Gerrit

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4mBVQnx2-1689922057903)(C:\Users\冯有凯\AppData\Roaming\Typora\typora-user-images\image-20230707143217687.png)]

一路回车点到最后

修改配置:

vim ~/review_site/etc/gerrit.config

 [gerrit]
        basePath = git
        canonicalWebUrl = http://localhost.localdomain:8081/
        serverId = 362064bc-c4a0-4215-bf14-ff9508e7e955
[container]
        javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
        javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
        user = gerrit
        javaHome = /usr/lib/jvm/java-11-openjdk-amd64
[index]
        type = lucene
[auth]
        type = HTTP
        userNameCaseInsensitive = true
[receive]
        enableSignedPush = false
[sendemail]
        smtpServer = localhost
[sshd]
        listenAddress = *:29418
[httpd]
        listenUrl = proxy-http://*:8091/
[cache]
        directory = cache
[gitweb]
    type = gitweb
    cgi = /usr/lib/cgi-bin/gitweb.cgi

配置gerrit账户

touch ~/Gerrit/passwords
sudo htpasswd -b ~/review_site/passwords admin password

5.安装gitweb

sudo apt-get install gitweb

6.重启gerrit和apache2

sudo ~/Gerrit/bin/gerrit.sh restart
sudo /etc/init.d/apache2 restart

iew_site/passwords admin password


#### 5.安装gitweb

```shell
sudo apt-get install gitweb

6.重启gerrit和apache2

sudo ~/Gerrit/bin/gerrit.sh restart
sudo /etc/init.d/apache2 restart

参考链接https://blog.csdn.net/qq_37793601/article/details/122279357

你可能感兴趣的:(git)