首页 > 技术文章 > Linux整合Apache和SVN

happyhuangjinjin 2018-01-04 22:37 原文

1、安装APR-1.2.7和APR-util-1.2.7 

(下载地址:http://apr.apache.org/)
#tar zxvf  apr-1.2.7.tar.gz
#cd   apr-1.3.9
#./configure
#make
#make install

#tar zxvf apr-util-1.2.7.tar.gz

#cd cd apr-util-1.3.9
#./configure --with-apr=/usr/local/apr/
#make

#make install

 

2、编译安装apache。
#tar zxvf httpd-2.2.3.tar.gz
#cd httpd-2.2.3
#./configure --prefix=/opt/apache   \

             --enable-dav           \

             --enable-so             \

             --enable-maintainer-mode  \

             --with-apr=/usr/local/apr/bin/apr-1-config  \

             --with-apr-util=/usr/local/apr/bin/apu-1-config
#make
#make install

检查是否安装成功

#cd   /opt/apache/bin

#./apachectl start

在浏览器中输入http://192.168.1.104/。

 

3、安装subversion-deps-1.6.1.tar.gz和subversion-1.6.1-tar.gz

#tar zxvf subversion-deps-1.6.1.tar.gz

#tar zxvf subversion-1.6.1.tar.gz

#cd subversion-1.6.1

#./configure    --prefix=/opt/svn     \

                --with-apxs=/opt/apache/bin/apxs  \

                --with-apr=/usr/local/apr/   \

                --with-apr-util=/usr/local/apr/

#make && make install

 

4、在apache中配置SVN

 

      #vi   /opt/apache/conf/httpd.conf

     如果你看到如下两句,说明安装是成功的

      LoadModule dav_svn_module     modules/mod_dav_svn.so

      LoadModule authz_svn_module   modules/mod_authz_svn.so

      如果有下面一句就用#注释掉

      #LoadModule foo_module modules/mod_foo.so

     定义apache访问svn配置:

      <Location /svn>

              DAV svn

              # SVNPath /opt/svndata

              SVNParentPath /opt/svn/bin/repository   //svn父目录

              //权限配置文件

              AuthzSVNAccessFile    

                     /opt/svn/bin/repository/project/conf/authz

              AuthType Basic  //连接类型配置

              AuthName "Subversion repository"   //连接矿提示

              //用户配置文件

              AuthUserFile

                    /opt/svn/bin/repository/project/conf/passwd

              Require valid-user  //采用何种认证

      </Location>

#./apachectl restart

 

5、建立和导入版本库
#cd   /opt/svn/bin

#mkdir ./repository

创建仓库

#./svnadmin   create   ./repository/project

#chmod  755  ./repository

配置用户文件和权限文件

#cd  ./repository/project/conf

与apache的配置相同/opt/svn/bin/repository/project/conf/passwd

#/opt/apache/bin/htpasswd -c   \

      /opt/svn/bin/repository/project/conf/passwd   huang(用户名)

跟apache配置相同/opt/svn/bin/repository/project/conf/authz

#vi /opt/svn/bin/repository/project/conf/authz

添加以下配置项:

 #仓库project的根目录访问权限

 [project:/]  

 #用户huang对仓库project的访问权限

     huang=rw

#表示所在所有仓库的根目录

 [/]

#表示所有用户具有读权限

*=r

 

导出使用以下命令

#/opt/svn/bin/svn checkout http://localhost:8888/svn/project

导入使用以下命令

#/opt/svn/bin/svn  import 需要导入文件的路径   导入到的仓库 -m "注释"

例子:

#/opt/svn/bin/svn  import   \

         /root/svn  file:///opt/svn/bin/repository/project \

         -m  "初始导入"

 

推荐阅读