devops's docs

git仓库: 1.3.0 本地服务器web界面


1. 使用apache+cgi方式来运行gitweb

1) 安装gitweb

# 下载git源码,里面有gitweb软件包
git clone git://git.kernel.org/pub/scm/git/git.git
cd git/
make GITWEB_PROJECTROOT="/data/git" prefix=/usr gitweb     
    SUBDIR gitweb
    SUBDIR ../
make[2]: 'GIT-VERSION-FILE' is up to date.
    GEN gitweb.cgi
    GEN static/gitweb.js
cp -Rf gitweb /var/www/

2) 配置apache

vim /etc/httpd/conf.d/web.git.conf
******************************
<VirtualHost *:80>
    ServerName web.gitserver
    DocumentRoot /var/www/gitweb
    <Directory /var/www/gitweb>
        Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
        AllowOverride All
        order allow,deny
        Allow from all
        AddHandler cgi-script cgi
        DirectoryIndex gitweb.cgi
    </Directory>
</VirtualHost>
******************************

3) 测试访问

测试访问


2. 错误解决

1.1) 错误信息:

Can't locate CGI.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /var/www/gitweb/gitweb.cgi line 13.

1.2) 解决办法:

yum install perl-CGI

2.1) 错误信息:

Can't locate Time/HiRes.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /var/www/gitweb/gitweb.cgi line 20.
BEGIN failed--compilation aborted at /var/www/gitweb/gitweb.cgi line 20.

2.2) 解决办法:

yum install perl-Time-HiRes