SVN安装手册

安装需要的软件包:

   Apr     APR-1.2.12APR-util-1.2.12

   Apache httpd-2.2.6.tar.gz

  Subversionsubversion-1.4.5.tar.gz subversion-deps-1.4.5.tar.gz

  Php    php-5.2.5.tar.gz

  Php支持库:libxml2-2.6.19.tar.gz

1、安装APR-1.2.12APR-util-1.2.12

1) #  tar zxvf  apr-1.2.12.tar.gz

      #  cd apr-1.2.12

      #  ./configure

      Make;make install

2) #  tar zxvf apr-util-1.2.12.tar.gz

  #  cd apr-util-1.2.12

  #  . /configure --with-apr=/usr/local/apr

  #  make;make install

2、安装apache 2.2.6

1解包 httpd-2.2.6.tar.gz

#  tar xzvf httpd-2.2.6.tar.gz

  2) 生成配置文件

#  ./configure --prefix=/usr/local/apache2 --enable-dav --enable-modules=so --enable-maintainer-mode --enable-rewrite --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config

3)生成make文件,并安装

  #  makemake  install

4)编辑配置文件httpd.conf

   # vi /usr/local/apache2/conf/httpd.conf

修改内容:

 ServerName www.example.com:80

ServerName localhost:80

保存退出

  5)启动Apache服务:

# /usr/local/apache2/bin/apachectl start

  6)浏览网站:

用浏览器查看http://localhost/,得到it works,说明apache已经配置成功了。

  7)停止Apache服务:

# /usr/local/apache2/bin/apachectl stop

  8)设置启动系统后,自启动Apache服务

编辑etc/rc.d/rc.local

# vi /etc/rc.d/rc.local

在最后加上一句: /usr/local/apache2/bin/apachectl start

3、安装subversion

1)解包

# tar xvzf subversion-1.4.5.tar.gz

# tar xvzf subversion-deps-1.4.5.tar.gz

2)转入解包目录并生成配置文件

# cd subversion-1.4.5

SVN 依赖的APR版本要正确。如果Apache2.0.x,对应的APR版本应为0.9.xApache2.2.x,对应的APR版本应为1.2.x 由于subversion-deps包里的APR0.9.x的,因此编译svn时要删除从deps里解压出来的apr, apr-util,改而使用apache 2.2里提供的。(这里指定为开始安装的apr目录)

如果apache不是安装在默认路径,configure加上--with-apxs选项,如:./configure --with-apxs=/usr/local/apache2/bin/apxs(此目录为我的apache安装目录)

# rm -rf apr

# rm -rf apr-util

#./configure --with-apxs=/usr/local/apache2/bin/apxs --prefix=/usr/local/subversion --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config --with-ssl --with-zlib --enable-maintainer-mode

3)编译安装

  # makemake install

4查看subversion两个动态库有没有安装成功

     # vi /usr/local/apache2/conf/httpd.conf

    看到下面两个模块说明安装成功

LoadModule dav_svn_module     modules/mod_dav_svn.so

LoadModule authz_svn_module   modules/mod_authz_svn.so

5 )配置apache 支持svn

   # vi / usr/local/apache2/conf/httpd.conf

  在文件末尾加上

   <Location /svn>

   DAV svn

        SVNParentPath /subversion/project  (此处配置你的版本库根目录) 

        AuthType Basic

        AuthName "Subversion repository"  (此处字符串内容修改为提示对话框标题)

      AuthUserFile /subversion/passwd     (此处修改为访问版本库用户的文件,用apache htpasswd命令生成)

        AuthzSVNAccessFile /subversion/auth (此处修改为访问版本库权限的文件)

        Require valid-user

    </Location>

6 )建立版本库

   先创建版本根目录

   # mkdir  -p  /subversion/project

   /usr/local/subversion/bin/svnadmin create /subversion/project/test

   更改版本库权限,这样通过apache服务访问svn的客户就有权限来编辑版本库文件

   Chown –R apache:apache /subversion/project/test

   进入到版本库 test中执行ls

   # cd  /subversion/project/test

   # ls  后看到以下文件夹及文件,则表示建库成功

conf  dav  db  format  hooks  locks  README.txt

测试用: 备份刚创建的SVN

    # /usr/local/subversion/bin/svnadmin dump / subversion/project/test > /usr/local/svn-test

    把备份出来的数据恢复到库中
# /usr/local/subversion/bin/svnadmin load /subversion/project < /usr/local/svn-test

7 ) 建立访问库用户文件

# /usr/local/apache2/bin/htpasswd –cm /subversion/passwd dyf (第一次添加用户需先创建文件,所以有参数-c,以后添加用户可以不用添加参数)

按照提示输入密码

8 )建立访问库权限文件

 # vi /subversion/auth

内容按照以下格式

[groups]

Tester=test,dyf

Developer=zb

[test:/]

@Tester = rw

dyf = rw

zb = r

9) 浏览器+权限 访问版本库

 重起apache

在浏览器中输入http://servername/svn/test

输入拥有访问权限的用户名,密码登陆,

4、安装php支持库 libxml2

   1)解包

      # tar -zxf libxml2-2.6.19.tar.gz

   2)生成配置文件

# ./configure --prefix=/usr/local/libxml2

3)编译并安装

  # makemake install

5、安装php  5.2.5

   1)解包

      # tar -zvxf php-5.2.5.tar.gz

2)生成配置文件

   # cd php-5.2.5

  # ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-libxml-dir=/usr/local/libxml --with-zlib --with-freetype-dir=/usr --enable-ftp

   3 )编译并安装

     #  makemake install

   4 )添加php配置文件

     #  cp php.ini-dist /usr/local/php/lib/php.ini

5)配置Apache让其支持php

 # vi /usr/local/apache2/conf/httpd.conf

找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容

AddType application/x-httpd-php .php .php3 .php4

AddType application/x-httpd-php-source .phps

找到DirectoryIndex index.html 修改成为 DirectoryIndex index.php index.html index.htm

6 apache 支持phpsvn中的所有版本库都显示出来

   /usr/local/apache2/htdocs目录下创建svn_index.php,内容如下:

<html>

<head>

<title>Subversion Repositories</title>

</head>

<body>

<h2>Subversion Repositories</h2>

<p>

<?php   $svnparentpath = "/subversion/project";

$svnparenturl = "/svn";

$dh = opendir( $svnparentpath );

if( $dh ) {

     while( $dir = readdir( $dh ) ) {

   $svndir = $svnparentpath . "/" . $dir;

        $svndbdir = $svndir . "/db";

          $svnfstypefile = $svndbdir . "/fs-type";

           if( is_dir( $svndir ) && is_dir( $svndbdir ) ) {

               echo "<a href=/"" . $svnparenturl . "/" .

                      $dir . "/">" . $dir . "</a>/n";

               if( file_exists( $svnfstypefile ) ) {

                 $handle = fopen ("$svnfstypefile", "r");

                 $buffer = fgets($handle, 4096);

                   fclose( $handle );

 $buffer = chop( $buffer );                

if( strcmp( $buffer, "fsfs" )==0 ) {

       echo " (FSFS) <br />/n"; } else {  echo " (BDB) <br />/n";              }

          } else {

                  echo " (BDB) <br />/n";

            }

             }    

    }        closedir( $dh );   }

?>

          </p>  

</body>  

</html>

上述php文件中svnparentpath = "/subversion/project";需要注意,这块儿配置你的subversion的代码仓库的根目录即可,请修改和你自己设置一样的路径。更改Apache的配置文件httpd.conf文件,在文件末尾加上如下几句:

RewriteEngine on

RewriteRule ^/svn$ /svn_index.php [PT]

RewriteRule ^/svn/$ /svn_index.php [PT]

RewriteRule ^/svn/index.html$ /svn_index.php [PT]

重新启动apache好了,请从新在浏览器地址栏中输入http://youserver/svn ,你会发现Apache会把当前Subversion根目录下的所有代码仓库列出来了。

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值