在OS X Yosemite Server上可以架设subversion服务器,采用http协议访问subversion源。具体过程为:
  
1. 安装与OS X Yosemite兼容的subversion:可以从wandisco公司的网站上下载subversion的安装包Subversion-1.8.10_10.10.x.pkg(下载地址为http://www.wandisco.com/subversion/os/downloads),也可以通过HomeBrew安装最新版的subversion。如果在升级OS X Yosemite之前没有升级HomeBrew,需要先升级HomeBrew。在OS X Yosemite上升级HomeBrew的方法参见:http://www.comdyn.cn/from-web/mac-os/378-get-homebrew-to-work-on-yosemite
 
2. 安装 mod_wsgi 包:
   brew install homebrew/apache/mod_wsgi
 
3. 配置OS X Server的appache服务器。
在OS X Server中,appache的配置文件为 “/Library/Server/Web/Config/apache2/httpd_server_app.conf”,而不是“/etc/apache2/httpd.conf”。httpd_server_app.conf自动包含目录 “/Library/Server/Web/Config/apache2/sites/” 下扩展名为conf的所有文件。在sites目录下增加以下和subversion相关的配置文件: 
 
1). 10-ports.conf
配置监听9880端口,通过该端口访问svn源。文件的内容为:
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost> directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 9880
Listen 127.0.0.1:13234
 
2). 21-svn-modules.conf
载入与svn相关的两个库文件“mod_dav_svn.so”和“mod_authz_svn.so”。 文件内容为:
LoadModule dav_svn_module /opt/subversion/lib/svn-apache/mod_dav_svn.so
LoadModule authz_svn_module /opt/subversion/lib/svn-apache/mod_authz_svn.so
 
3). 21-wsgi-modules.conf
载入mod_wsgi.so库,并且指定python的路径。 文件内容为:
LoadModule wsgi_module /usr/local/Cellar/mod_wsgi/3.5/libexec/mod_wsgi.so

# Tell mod_wsgi where Python is to avoid having to update PATH
WSGIPythonHome /System/Library/Frameworks/Python.framework/Versions/2.7
 
4). 30-user.conf
设定同于访问svn的用户名和组名,均设为ubersvn。文件内容:
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User ubersvn
Group ubersvn
</IfModule>
</IfModule>
 
5). 40-subversion.conf
subservion的一些参数配置。文件内容为: 
#
# For more information on HTTPD configuration options for Subversion please see:
# http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html
# Please remember that when using webdav HTTPD needs read and write access your repositories.
 
# You can generate your username/password file data from here:
# http://www.htaccesstools.com/htpasswd-generator/
Timeout 300
MaxKeepAliveRequests 100
KeepAlive On
KeepAliveTimeout 15
#ThreadsPerChild 64
MaxRequestsPerChild 0
 
6). 50-repositories.conf
配置svn源的位置,可以有多个svn源。该文件中配置了各svn源的绝对路径、访问控制方法、log文件等。由于该文件将svn源配置为9880端口,因此OS X Server可能会自动将其更名为:0000_any_9880_.conf。文件内容为:
<VirtualHost *:9880>
  KeepAlive On
  <Location /public>
    DAV svn
    SVNPath "/opt/ubersvn/repositories/public"
    AuthType Basic
    AuthName "Subversion Repository"
    Require valid-user
    AuthUserFile "/opt/ubersvn/conf/svn.passwd"
    AuthzSVNAccessFile "/opt/ubersvn/conf/svn.authz"
    Order deny,allow
    Allow from all
    SVNAutoversioning On
  </Location>
 
  <Location /opensource>
    … … 定义其它svn源
  </Location>
 
  CustomLog /opt/ubersvn/data/logs/svn_logfile "%t %u %{SVN-ACTION}e" env=SVN-ACTION
</VirtualHost>
 
此后即可以在svn中通过http://svn.comdyn.cn:9880/public来访问public源,例如
   svn list http://svn.comdyn.cn:9880/public
将列出该源下的所有内容。
 
注:以上配置参考了UberSVN。UberSVN目前已经停止更新,在OS X Yosemite上也无法安装使用了。

用户登录