【Akroma, Angel of Fury】完成svn环境搭建

昨天的那篇博文偏偏是实验室所干的事儿服务器

可是那是一种很投机取巧的方式完成的多project管理方式less

来看看我创建环境的方法ide

首先,找一个比较闲的公用服务器(为何不用本身的?有公共资源不用,你傻啊?),这里我用的是wl22这台服务器svn

找到这个服务器上的一个闲置用户(就是没人用的帐号,其实只是利用这个帐号真身在这台服务器上的特性,好操做罢了)ui

以后好比我用的是junze这个用户,要把个人svn的服务器建起来,只须要根据下面几个步骤来就好this

cd ~
mkdir svn_root
svnadmin create --fs-type fsfs /home/junze/svn_root/project_1
svnadmin create --fs-type fsfs /home/junze/svn_root/project_2

这里要注意的是,只须要创建母目录/home/junze/svn_root 以后用svn的命令去创建底下的project目录,接下来import进内容spa

svn import /home/ql/project_1 file:///home/junze/svn_root/project_1 -m "Import initial"
svn import /home/ql/project_2 file:///home/junze/svn_root/project_2 -m "Import initial"

这里,这两个项目就创建完成了,接着来操做权限。把每一个project下面的conf/svnserve.conf中的相应注释去掉,以后因为我比较懒,想共享passwd和authz,那就这么改一下,对多个project,改掉相应的realm就能够了,使用一样的passwd和authz就能够,后面附上code

### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)

### Visit http://subversion.tigris.org/ for more information.

[general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### and "none".  The sample settings below are the defaults.
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 conf directory.
### Uncomment the line below to use the default password file.
password-db = /home/junze/svn_root/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 conf
### directory.  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 = /home/junze/svn_root/authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa.  The default realm
### is repository's uuid.
realm = project_1 Repository

passwdorm

### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

[users]
admin = admin
user_vip = user_vip
guest = guest

而此时authz须要当心一点,我用的parent+path的格式blog

### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to a
### single user, to a group of users defined in a special [groups]
### section, or to anyone using the '*' wildcard.  Each definition can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').

[groups]
project_1RW = admin, user_vip
project_1R = guest
project_2RW = admin
project_2R = user_vip, guest

[project_1:/]
@project_1RW = rw
@project_1R = r
* =

[project_2:/]
@project_2RW = rw
@project_2R = r
* =

这里要注意的是你开启svnserve的时候的路径和你如今指定的路径是有关系的,反正按照我说的来老是没错的,下一步就是开启svnserve服务器就能够开始访问svn了

svnserve -d -r /home/junze/svn_root/

好了,能够开始使用svn了

svn ls svn://wl22/project_1 --username user_vip --password user_vip

good luck, guys

相关文章
相关标签/搜索