您的位置:首页 > 运维架构 > Linux

CentOS5.6下gitweb的安装搭建

2012-01-09 19:26 281 查看
这类资料网上有很多,但是因为系统或版本问题,不能完全适用,在这里记录下,希望我犯过的错误能给大家些提示;

这里我们将gitweb安装到 /var/www/cgi-bin/gitweb/,git已经安装,路径为 /usr/local/bin/git
git版本:git-1.7.8.2
repositories地址: /home/gitolite/repositories

1. 用root登录 首先执行
        make GITWEB_PROJECTROOT="/home/gitolite/repositories" \
             GITWEB_JS="gitweb/static/gitweb.js" \
             GITWEB_CSS="gitweb/static/gitweb.css" \
             GITWEB_LOGO="gitweb/static/git-logo.png" \
             GITWEB_FAVICON="gitweb/static/git-favicon.png" \
             bindir=/usr/local/bin \
             gitweb
2.  make gitwebdir=/var/www/cgi-bin/gitweb install-gitweb

3. 修改/etc/gitweb.conf,若该文件不存在,则新建之
加入如下内容:
$projectroot = "/home/gitolite/repositories";
$GIT = "/usr/local/bin/git" #这行一定要加,gitweb.cgi里默认的GIT路径是/root/bin/git,如果不显式地写出来,会找不到project

4. 修改apache配置文件 
[root@gitserver ~]# vim /etc/httpd/conf/httpd.conf

加入以下内容:
<VirtualHost *:80>
    ServerName gitserver
    DocumentRoot /var/www/cgi-bin/gitweb
    <Directory /var/www/cgi-bin/gitweb>
        Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
        AllowOverride All
        order allow,deny
        Allow from all
        AddHandler cgi-script cgi
        DirectoryIndex gitweb.cgi
    </Directory>
</VirtualHost>

4.修改repositories及其上级目录的权限

chmod 775 /home/gitolite/repositories
chmod 775 /home/gitolite
若提示“404 project not found”,很大的可能是因为该步骤的权限设置的不正确

5.在浏览器中输入 http://localhost,repository中的所有project都显示出来了


参考文档:参见git源代码包中的gitweb安装说明
/usr/local/src/git-1.7.8.2/gitweb/INSTALL
http://progit.org/book/ch4-6.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息