安装Subversion1.6和Apache

1.检测是否已安装subversion

[root@localhost subversion-1.6.13]# rpm -qa |grep subversion
subversion-1.4.2-4.el5_3.1


2.卸载subversion
[root@localhost subversion-1.6.11] rpm -e subversion --nodeps
[root@localhost subversion-1.6.11]# rpm -e subversion-1.4.2-4.el5_3.1

如果报error: "subversion-1.4.2-4.el5_3.1" specifies multiple packages
[root@localhost bin]# rpm -e --allmatches subversion-1.4.2-4.el5_3.1




1、安装apr
      apr-1.3.6.tar.gz  
      下载地址:http://apr.apache.org/
      tar zxvf  apr-1.3.6.tar.gz #解压包
      cd apr-1.3.6
      ./configure
      make
      make install
 


2、安装apr-util
      apr-util-1.3.8.tar.gz
      tar zxvf apr-util-1.3.8.tar.gz
      cd apr-util-1.3.8
      ./configure --with-apr=/usr/local/apr
      make
      make install


3、安装 apache
      httpd-2.2.9.tar.gz 下载地址:http://httpd.apache.org/
      tar zxvf  httpd-2.2.9.tar.gz
      cd httpd-2.2.9
      ./configure --prefix=/usr/local/apache2 --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  
      #--prefix表示把apache安装在指定目录
      make
      make install


3.下载subversion
   
1. http://subversion.tigris.org/downloads/subversion-1.6.13.tar.bz2  
2. http://subversion.tigris.org/downloads/subversion-deps-1.6.13.tar.bz2  


4、解压(不要乱了顺序)
      tar zxvf  subversion-1.6.13.tar.gz 
      tar zxvf  subversion-deps-1.6.13.tar.gz

      cd subversion-1.6.13
      ./configure --prefix=/opt/svn/subversion --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr
      make
      make install

      至此,安装基本完毕,再配置下就可以使用了


配置apache
vi /usr/local/apache2/conf/httpd.conf
1)安装是成功后,会有
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so


2)在虚机中添加
<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName 192.168.1.100
    <Location /svn>
        DAV  svn
        SVNParentPath /data/svn_repos
        SVNListParentPath On
        SVNAutoversioning On
        SVNReposName "svn"
        AuthzSVNAccessFile /data/svn/conf/authz.conf
        AuthType Basic
        AuthName "Subversion repository"
        AuthUserFile /data/svn/conf/passwd.conf
        Require valid-user
    </Location>
</VirtualHost>


配置svn
1)建立svn版本库目录
mkdir -p /data/svn_repos/repos 

可以多建版本库目录,这里我的目录是repos

2)建立svn版本库
svnadmin create /data/svn_repos/repos

因为apache的线程使用的用户是daemon
 
chown -R daemon /data/svn_repos/repos
chmod -R 755 /data/svn_repos/repos


3)建立本地访问控制文件
      /usr/local/apache2/bin/htpasswd -c /data/svn/conf/passwd.conf  username

      然后输入密码即可,默认是MD5加密的
      /usr/local/apache2/bin/htpasswd  /data/svn/conf/passwd.conf  username1
#追加用户

     

4)建立本地项目控制文件
      touch /opt/svn/conf/authz.conf

本例authz.conf内容为:
      [groups]
      #<groupname1>=<username1>,<username2>
      admin=username

      #[<versionLib>:projectName/directory]
      #@<groupsname>=<authorities>
      #<username>=<authorities>

      [/]
      @admin = rw      
	#指定用户组成员可以读写根目录所有应用

      [repos:/abc/aaa]
      username1= rw     
	 #指定用户username1可以读写:/abc/aaa目录的文件


测试连接
1)启动apache
      /usr/local/apache2/bin/apachectl start
2)再浏览器访问http://192.168.1.100/svn/repos
     #本例服务器ip是192.168.1.100
     使用刚才创建的权限用户名与密码登录即可访问

/////////////////////////////////
ldap的apache文件

    <Location />

    # Enable Subversion
    DAV svn
    SVNParentPath /data/svn_repos
    SVNListParentPath On
    #SVNIndexXSLT "/repos-web/view/repos.xsl"
    # Enable WebDav automatic versioning
    SVNAutoversioning On
    # Repos display name
    SVNReposName "twitter"
    AuthType Basic
    AuthName "XXX"
    AuthBasicProvider "ldap"
    authzldapauthoritative Off
    AuthLDAPBindDN  "[email protected]"
    AuthLDAPBindPassword "XXXXX"
    AuthLDAPURL "ldap://ldap.XXXX.com:389/DC=XXX,DC=com?sAMAccountName?sub?(objectClass=*)"
    Require valid-user
    Require group "cn=XXX-tech, ou=groups, dc=XXX, dc=com"
    # Authorization file
    #AuthzSVNAccessFile /
    </Location>

猜你喜欢

转载自running.iteye.com/blog/816419