FreeBSD - FreeBSD8.2下搭建Subversion

来源:互联网 发布:bdp商业数据平台 编辑:程序博客网 时间:2024/06/03 17:52

        freebsd搭建svn有几种方法,可以将svn单独启动,也可以通过apache启动,apache方式的我试了很多次都没有安装好,就只有使用svn自带的服务启动方式了,下面是综合网上资料自己试验成功的步骤(以下都是在root权限下)。

1,ports方式安装subversion

cd /usr/ports/devel/subversion             //进入ports的svn所在目录

make install clean                                  //安装命令,会自动下载并安装svn,网上有的说需要添加一些参数,因为没有用到apache模块,就不用那些参数了

2,创建仓库根目录和测试仓库

选择一个位置作为svn仓库根目录,这里我用/usr/svn作为仓库根目录,此处根目录意思就是里面会存放很多仓库文件,一般一个项目就是一个仓库

mkdir /usr/svn

创建好根目录后创建实际的仓库

svnadmin create /usr/svn/project1         //project1是仓库名,可以换别的名字

3配置权限

在每个仓库都会有conf文件夹,里面包含了配置文件passwd(用户密码),authz(用户和用户组权限),svnserve.conf(仓库配置文件),自己给的解释,大概能懂就行

a、增加一个用户,打开passwd文件,加入一个用户名与密码:如
[users]
# harry = harryssecret
# sally = sallyssecret
test = test                     //这里加入一个test用户,并且密码是test

b、修改用户权限:
打开authz文件,配置如下:(只要修改groups节点)
[groups]
admin = test                //这里表示有一个admin用户组,这个用户组中用一个叫test的用户
[/]                                    //这里是特别需要注意,svnserve -r -d /usr/svn/, 如果启动时指定的是 -r -d /usr/svn/project1   这里就要 用 [/project1] 

@admin = rw                //表示admin组中的用户都有读写权限
* = r
# [repository:/baz/fuz]

c、修改svnserver.conf文件,配置如下:
anon-access = none #表示不允许匿名用户访问
auth-access = write    #通过认证的用户可以写
### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd #指定密码文件
### The authz-db option controls the location of the authorization
### rules for path-based access control. Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file. If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz #指写权限分配文件

4,启动服务

svn默认启动的是IPV6的,所以在启动时需要加一些参数:

svnserve -d -r /usr/svn/--listen-host=0.0.0.0 --listen-port=3690           //-d好像是在后台运行  -r是仓库的目录或根目录
这样就可以了。

关闭服务使用:killall svnserve


原创粉丝点击