1 - GitWeb简介

GitWeb是一个支持在Web页面上查看代码以及提交信息的工具。

安装GitWeb工具并且集成到Gerrit中,就可以直接在Gerrit的项目列表中查看项目的代码信息。

2 - 安装GitWeb

启动gerrit服务

[gerrit@mt101 ~]$ sudo gerrit_testsite/bin/gerrit.sh start
Starting Gerrit Code Review: OK
[gerrit@mt101 ~]$
[gerrit@mt101 ~]$ sudo service nginx start
Redirecting to /bin/systemctl start nginx.service
[gerrit@mt101 ~]$



通过yum安装GitWeb

[gerrit@mt101 ~]$ sudo yum -y install gitweb
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
mongodb-org-4.0 | 2.5 kB 00:00:00
nginx-stable | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package gitweb.noarch 0:1.8.3.1-20.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================
Package Arch Version Repository Size
=====================================================================================================
Installing:
gitweb noarch 1.8.3.1-20.el7 base 112 k

Transaction Summary
=====================================================================================================
Install 1 Package

Total download size: 112 k
Installed size: 320 k
Downloading packages:
gitweb-1.8.3.1-20.el7.noarch.rpm | 112 kB 00:00:07
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : gitweb-1.8.3.1-20.el7.noarch 1/1
Verifying : gitweb-1.8.3.1-20.el7.noarch 1/1

Installed:
gitweb.noarch 0:1.8.3.1-20.el7

Complete!
[gerrit@mt101 ~]$

3 - 设置projectroot目录

配置文件:/etc/gitweb.conf 

[gerrit@mt101 ~]$ sudo vim /etc/gitweb.conf
[gerrit@mt101 ~]$ sudo cat /etc/gitweb.conf |grep -v "#" |grep -Ev "^$"
our $projectroot = "/home/gerrit/gerrit_testsite/git"
[gerrit@mt101 ~]$

4 - 配置GitWeb的httpd服务

4.1 配置GitWeb路径

GitWeb是基于httpd服务工作的,配置文件:/etc/httpd/conf.d/git.conf

[gerrit@mt101 ~]$ sudo cat /etc/httpd/conf.d/git.conf
Alias /git /var/www/git

<Directory /var/www/git>
Options +ExecCGI
AddHandler cgi-script .cgi
DirectoryIndex gitweb.cgi
</Directory>
[gerrit@mt101 ~]$
[gerrit@mt101 ~]$ sudo vim /etc/httpd/conf.d/git.conf
[gerrit@mt101 ~]$
[gerrit@mt101 ~]$ sudo cat /etc/httpd/conf.d/git.conf
Alias /gitweb /var/www/git
SetEnv GITWEB_CONFIG /etc/gitweb.conf
<Directory /var/www/git>
Options +ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All
order allow,deny
Allow from all
AddHandler cgi-script .cgi
DirectoryIndex gitweb.cgi
</Directory>
[gerrit@mt101 ~]$

4.2 配置服务端口

/etc/httpd/conf/httpd.conf中配置服务端口

[gerrit@mt101 ~]$ sudo cat /etc/httpd/conf/httpd.conf |grep -v "#" |grep -Ev "^$" |grep -i listen
Listen 80
[gerrit@mt101 ~]$
[gerrit@mt101 ~]$ sudo vim /etc/httpd/conf/httpd.conf
[gerrit@mt101 ~]$ sudo cat /etc/httpd/conf/httpd.conf |grep -v "#" |grep -Ev "^$" |grep -i listen
Listen 8084
[gerrit@mt101 ~]$

4.3 重启httpd服务

[gerrit@mt101 ~]$ sudo systemctl restart httpd.service
[gerrit@mt101 ~]$ sudo systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2019-12-10 22:57:22 CST; 9s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 3432 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Main PID: 3439 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
Tasks: 7
CGroup: /system.slice/httpd.service
├─3439 /usr/sbin/httpd -DFOREGROUND
├─3440 /usr/sbin/httpd -DFOREGROUND
├─3441 /usr/sbin/httpd -DFOREGROUND
├─3442 /usr/sbin/httpd -DFOREGROUND
├─3443 /usr/sbin/httpd -DFOREGROUND
├─3444 /usr/sbin/httpd -DFOREGROUND
└─3445 /usr/sbin/httpd -DFOREGROUND

Dec 10 22:57:16 mt101 systemd[1]: Starting The Apache HTTP Server...
Dec 10 22:57:21 mt101 httpd[3439]: AH00558: httpd: Could not reliably determine the server's f...sage
Dec 10 22:57:22 mt101 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
[gerrit@mt101 ~]$

4.4 开放防火墙

[gerrit@mt101 ~]$ sudo firewall-cmd --zone=public --permanent --add-port=8084/tcp
success
[gerrit@mt101 ~]$ sudo firewall-cmd --reload
success
[gerrit@mt101 ~]$ sudo firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3 enp0s8
sources:
services: ssh dhcpv6-client
ports: 8080/tcp 80/tcp 83/tcp 8083/tcp 8084/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules: [gerrit@mt101 ~]$

5 - 访问GitWeb

6 - 和Gerrit集成

6.1 更新Gerrit配置文件

增加如下部分

[gitweb]
type = gitweb
cgi = /var/www/git/gitweb.cgi
[gerrit@mt101 ~]$ sudo vim gerrit_testsite/etc/gerrit.config
[gerrit@mt101 ~]$ sudo cat gerrit_testsite/etc/gerrit.config
[gerrit]
basePath = git
canonicalWebUrl = http://192.168.16.101:8083/
serverId = 0b911b9e-195a-46b0-a5cd-b407b776b344
[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 = root
javaHome = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64/jre
[index]
type = lucene
[auth]
type = HTTP
[receive]
enableSignedPush = false
[sendemail]
smtpServer = localhost
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = http://192.168.16.101:8083/
[cache]
directory = cache
[gitweb]
type = gitweb
cgi = /var/www/git/gitweb.cgi
[gerrit@mt101 ~]$

6.2 修改git配置

[gerrit@mt101 ~]$ git config --file /home/gerrit/gerrit_testsite/etc/gerrit.config gitweb.cgi /var/www/git/ gitweb.cgi
[gerrit@mt101 ~]$ git config --file /home/gerrit/gerrit_testsite/etc/gerrit.config --unset gitweb.url
[gerrit@mt101 ~]$

6.3 重启Gerrit服务

[gerrit@mt101 ~]$ sudo gerrit_testsite/bin/gerrit.sh restart
Stopping Gerrit Code Review: OK
Starting Gerrit Code Review: OK
[gerrit@mt101 ~]$

6.4 重新登录,确认GitWeb链接

BROWSE---》Repositories---》Repository Browser---》gitweb链接

点击All-Project的gitweb链接

6.5 配置GitWeb访问权限

默认只有Gerrit管理员用户才有GieWeb的访问权限。

BROWSE---》Repositories---》All-Projects---》Access---》Reference: refs/meta/config

在“refs/meta/config”的Read选项中添加“Registered Users”的ALLOW 权限

Gerrit - 安装配置GitWeb的更多相关文章

  1. gerrit安装配置记录

    gerrit安装配置 java -jar gerrit-2.13.5.war init -d gerrit Authentication method [OPEN/?]: htt Install Ve ...

  2. Gerrit安装配置

    环境: CentOS 1611 + gerrit-2.11.4 (review.openstack.org) 1. 安装java1.8 (>1.7) [root@review ~]# yum i ...

  3. 安装配置gerrit

    Centos 安装配置gerrit 关闭selinux,不然nginx的反向代理会报错connect() to 127.0.0.1:8080 failed (13: Permission denied ...

  4. gerrit+nginx+centos安装配置

    安装环境 centos 6.8 gerrit-full-2.5.2.war 下载地址:https://gerrit-releases.storage.googleapis.com/gerrit-ful ...

  5. Gerrit+apache+H2数据库简单安装配置及建库流程

    Gerrit 是一个基于 Web 的代码评审和项目管理的工具,面向基于 Git 版本控制系统的项目.因此需要Apache.Mysql.GIT等相关软件的支持 系统配置: 新装的UBANTU LINUX ...

  6. Gerrit安装

    1.安装gerrit [sisi@pre-srv44 ~]$ su - gerrit2Password: [gerrit2@pre-srv44 ~]$ lltotal 83872-rw-r--r-- ...

  7. Gerrit2安装配置

    我主要根据下面这个文章而安装,遇到一些小问题,记录如下:2016.4.30 安装 2.12.2,要将加密的东东全装上!!!注意                      1) 由于新的git-bash ...

  8. Centos7安装配置gitlab

    Centos7安装配置gitlab 这篇文字我会介绍在Centos7上安装gitlab,配置gitlab的smtp,并且创建项目demo. sudo yum install openssh-serve ...

  9. Git服务器的Gitosis安装配置及gitignore的使用方法

    Git服务器Gitosis安装设置 1.安装 openssh服务器 sudo apt-get install openssh-server openssh-client 2.创建个人公钥和私钥 在默认 ...

随机推荐

  1. discuz x3.3后台admin.php防止直接恶意访问

    功能说明:admin.php是discuz默认的后台地址,正常情况下可以直接访问,为了防止某些恶意访问的情况,可以修改以下内容进行安全性能提升. 适用版本:Discuz!x1-x3.3 具体实施方案: ...

  2. Ofbiz项目学习——阶段性小结——查询

    一.组装参数的学习 首先是查询条件,对于查询条件,需要判断是否从前端传递空值?——怎么处理查询空值? 当然可以一个一个进行判断,但是这样代码会导致很多,可以统一处理,形成一个公共方法. 1. 单个处理 ...

  3. React.js Tutorial: React Component Lifecycle

    Introduction about React component lifecycle. 1 Lifecycle A React component in browser can be any of ...

  4. presto-gateway 试用以及docker 镜像制作

    presto-gateway 是 lyft 团队开源 的prestodb 的工具.以下是一个简单的试用,以及碰到问题的解决 还有就是docker 镜像的制作 Dockerfile 很简单,本地构建然后 ...

  5. 退役IV次后做题记录

    退役IV次后做题记录 我啥都不会了.... AGC023 D 如果所有的楼房都在\(S\)同一边可以直接得出答案. 否则考虑最左最右两边的票数,如果左边>=右边,那么最右边会投给左边,因为就算车 ...

  6. 使用electron开发桌面级小程序自动部署系统

    那一天我二十一岁,在我一生的黄金时代,我有好多奢望.我想爱,想吃,还想在一瞬间变成天上半明半暗的云,后来我才知道,生活就是个缓慢受锤的过程,人一天天老下去,奢望也一天天消逝,最后变得像挨了锤的牛一样. ...

  7. golang字节数组拷贝BlockCopy函数实现

    在C#中,Buffer.BlockCopy(Array, Int32, Array, Int32, Int32) 函数使用比较广泛,其含义: 将指定数目的字节从起始于特定偏移量的源数组复制到起始于特定 ...

  8. 【面向对象】第三单元总结——JML

    梳理JML语言的理论基础.应用工具链情况 JML语言理论基础 JML(Java Modeling Language)是一种行为规范接口语言,通过使用不会被编译的注释形式,和固定关键字的语法,指定Jav ...

  9. Java多次启动相同jar程序

    背景 现在很多软件都支持集群部署,但是测试环境通常资源有限,所以一般通过单台机器模拟集群部署(使用不同端口,运行相同jar包),本文的目的就是通过多种方式实现此需求. 两个程序 1.jar程序 ① s ...

  10. 在Asp.Net Core 3.0中如何使用 Newtonsoft.Json 库序列化数据

    在.Net Core 3.0中 内置了一套Json序列化/反序列化方案,默认可以不再依赖,不再支持   Newtonsoft.Json. 但是.NET Core 3.0 System.Text.Jso ...