2iqyb5213a 发表于 2016-5-17 08:07:20

Mac OS X 10.7.2下搭建SVN服务器

  Mac操作系统已经内置了apache和svn,下面对进一步的配置做说明。
  

  1、在系统偏好设置-》共享中,选中“web共享”
  

  2、修改/etc/apache2/httpd.conf,添加如下内容
  

      LoadModule dav_svn_module libexec/apache2/mod_dav_svn.so
  

      LoadModule authz_svn_module libexec/apache2/mod_authz_svn.so
      Include /private/etc/apache2/extra/httpd-svn.conf
  

  

  3、在/etc/apache2/extra目录下创建文件httpd-svn.conf,添加如下内容
  

       <Location /svn >
  DAV svn
  #SVNParentPath "/Users/chengcheng/svnRepository"
  SVNPath "/Users/chengcheng/svnRepository"
  # user authentication
  AuthType Basic
  AuthName "Subversion repository"
  AuthUserFile "/Users/chengcheng/svnRepository/conf/passwd"
  AuthzSVNAccessFile "/Users/chengcheng/svnRepository/conf/authz"
  # only authenticated users may access the repository
  Require valid-user
  </Location>
  

   注:chengcheng是我mac机器的用户名
         svnRepository是库命
  

  

  4、初始化SVN源码库
  

      svnadmin create /Users/chengcheng/svnRepository
  

  
    注:查看了下系统用户中没有apache用户,我偷懒,直接chmod -R 777 /Users/chengcheng/svnRepository,如果不授权,倒时候是不能写入文件的。
  

  

  5、启动服务器。
  

       svnserve -d -r /Users/chengcheng/svnRepository
  

  6、配置/Users/chengcheng/svnRepository/conf下的配置文件
     
      修改svnserve.conf,如下:
      anon-access = none
      auth-access = write
      password-db = passwd
      uthz-db = authz
  

  

  

      重新创建passwd并添加用户:
      sudo htpasswd -c /Users/chengcheng/svnRepository/conf/passwd zhangxf
  

      添加另外一个用户,后面用:
      htpasswd -mb /Users/chengcheng/svnRepository/conf/passwd wangjt 123456
   
      修改authz
      
      admin = zhangxf
  

      [/]
      @admin = rw
      * = r
  

      用户zhangxf及所在组的其他用户有库根目录的读写权限
      除admin组外的其他用户(目前我只建了一个wangjt),只有读权限。
  

  

  7、重启apache
       sudo apachectl restart
  

  8.、测试:
       http://localhost/svn
  

   
  另外关闭svn服务,直接ps aux | grep svn,然后kill -9 进程号
页: [1]
查看完整版本: Mac OS X 10.7.2下搭建SVN服务器