本文基于Mac OS X Lion.

编辑文件/etc/rc.common

View Code BASH

1 sudo vim /etc/rc.common

尾部添加内容:

View Code BASH

1 2 3 if [ -f /etc/rc.local ]; then     sh /etc/rc.local fi

创建文件/etc/rc.local

View Code BASH

1 sudo touch /etc/rc.local

然后就可以像Linux一样使用/etc/rc.local了。

/etc/rc.local示例:

View Code SH

1 2 3 4 5 6 7 8 9 10 11 12 13 ############################ # rc.local ############################ # # Gearmand Server #

/usr/local/sbin/gearmand -d -u root

# # Nginx Web Server #

/usr/local/bin/nginx

因为我们的svn服务器的版本太低(1.4.2版本),而我们需要用到1.6以上版本的目录合并功能,因此,需要对我们的svn服务器进行了升级。按照以前的安装方法进行了安装,发现出了不少问题。

原因是以前安装的时候操作系统是32位的系统,此次安装的为64位的系统。

再次记录上此次成功安装的步骤:

  1. 下载、编译和安装openssl [可选]

如果想让svn服务器支持https等加密的ssl链接,需要编译此模块

[flavorzhu@self ~]$ wget http://www.openssl.org/source/openssl-1.0.0d.tar.gz

[flavorzhu@self ~]$tar -zxvf openssl-1.0.0d.tar.gz

[flavorzhu@self ~]$cd openssl-1.0.0d

[flavorzhu@self ~]$./config –prefix=/usr/local/openssl

[flavorzhu@self ~]$sudo make  && make install

  1. 下载、编译和安装apache

[flavorzhu@self ~]$wget http://mirror.bjtu.edu.cn/apache/httpd/httpd-2.2.19.tar.gz

[flavorzhu@self ~]$tar  -zxvf  httpd-2.2.19.tar.gz

[flavorzhu@self ~]$cd httpd-2.2.19

[flavorzhu@self ~]$./configure –prefix=/usr/local/apache \

–enable-lib64 \

–enable-mods-shared=all

[flavorzhu@self ~]$ sudo make && make install

  1. 下载、编译和安装BerkeleyDB

http://www.oracle.com/technetwork/database/berkeleydb/downloads/index.html 下载Berkeley db,编译并安装

比如我下载的是4.8.24版本

[flavorzhu@self ~]$tar -zxvf db-4.8.24.tar.gz

[flavorzhu@self ~]$cd db-4.8.24/build_unix/

[flavorzhu@self ~]$../dist/configure –/usr/local/BerkeleyDB.4.8

[flavorzhu@self ~]$sudo make && make install

将Berkeley DB的.so加入到ld.so.conf中

[flavorzhu@self ~]$sudo  echo /usr/local/BerkeleyDB.4.8 >> /etc/ld.so.conf

[flavorzhu@self ~]$sudo /sbin/ldconfig

svn的存储有Berkeley DB(2001年开始支持) 和 FSFS(2004年开始支持)系统两种存储,默认使用的是FSFS模式的(如果没有安装Berkeley DB)。

详情见:http://www.zhuyanbin.com/?p=74

  1. 下载、编译和安装subversion依赖包

[flavorzhu@self ~]$wget  http://subversion.tigris.org/downloads/subversion-deps-1.6.16.tar.gz

[flavorzhu@self ~]$tar zxvf subversion-deps-1.6.16.tar.gz

[flavorzhu@self ~]$cd subversion-1.6.16

4.1 安装apr

注:Apache Portable Runtime

[flavorzhu@self ~]$cd apr

[flavorzhu@self ~]$./configure –prefix=/usr/local/apache LDFLAGS=”-L/lib6″

[flavorzhu@self ~]$sudo make && make install

4.2 编译和安装apr-util

[flavorzhu@self ~]$cd apr-util

[flavorzhu@self ~]$./configure –prefix=/usr/local/apache –with-apr=/usr/local/apache LDFLAGS=”-L/lib64″ –with-berkeley-db=/usr/local/BerkeleyDB.4.8

[flavorzhu@self ~]$sudo make && make install

4.3 编译和安装neon

注:neon是使得svn客户端支持http和https协议的关键模块

[flavorzhu@self ~]$cd neon/

[flavorzhu@self ~]$./configure –prefix=/usr/local/neon –enable-shared –enable-ssl –with-ssl=openssl LDFLAGS=”-L/lib64″

[flavorzhu@self ~]$sudo make && make install

4.4 编译和安装serf

[flavorzhu@self ~]$cd serf/

[flavorzhu@self ~]$./configure –prefix=/usr/local/serf –with-apr=/usr/local/apache –with-apr-util=/usr/local/apache –with-openssl=/usr/local/openssl LDFLAGS=”-L/lib64″

[flavorzhu@self ~]$sudo make && make install

4.5 编译和安装zlib

[flavorzhu@self ~]$cd zlib/

[flavorzhu@self ~]$./configure –prefix=/usr/local/zlib

[flavorzhu@self ~]$sudo make && make install

4.6 下载、编译和安装subversion

[flavorzhu@self ~]$wget  http://subversion.tigris.org/downloads/subversion-1.6.16.tar.gz

[flavorzhu@self ~]$tar zxvf subversion-1.6.16.tar.gz

[flavorzhu@self ~]$ cd subversion-1.6.16

将subversion依赖包中的sqlite-amalgamation拷贝到subversion-1.6.16里

[flavorzhu@self ~]$./autogen.sh

[flavorzhu@self ~]$./configure  –with-ssl –with-zlib=/usr/local/zlib –with-apr=/usr/local/apache –with-apr-util=/usr/local/apache –with-serf=/usr/local/serf –with-neon=/usr/local/neon LDFLAGS=”-L/lib64″

[flavorzhu@self ~]$sudo make && make install

注:在make之前检查一下,subversion里的Makefile的BerkeleyDB的lib包使用引用正确的版本,具体搜索一下, 比如我的是“-ldb-4.8”

配置apache

修改httpd.conf,增加如下代码

LoadModule dav_module modules/mod_dav.so

LoadModule dav_svn_module     modules/mod_dav_svn.so

LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /svn>

DAV svn

SVNParentPath /absolute/path/to/repository

AuthzSVNAccessFile /my/svn/user/authz.conf

AuthType Basic

AuthName “Subversion”

AuthUserFile  /my/svn/user/passwd/file

Require valid-user

</Location>

 

  1. subversion仓库的升级

5.1 方法一 upgrade方式

svnadmin upgrade /path/to/repository

5.2 方法二 dump/load方式

svnadmin dump your-repository > repository.dump

svnadmin create your-repository

svnadmin load your-repository < repository.dump

经过测试,使用dump/load方式比较靠谱,不管你使用那种方式升级你的仓库,操作之前备份你的仓库都是不可省略的步骤。