先使用svnserve --version命令查看有没有安装svn服务器。linux
能够看到已经安装了,若是没有安装使用以下命令安装:windows
yum install -y subversion
mkdir /home/svn #我这里把版本库放在了home目录下的svn文件夹,方便管理 svnadmin create /home/svn/repo0 #我这里将svn做为全部版本库的目录,并建立了一个名为repo0的版本库仓库
进入刚才的建立的这个版本库的conf目录来配置这个repo0的版本库,能够看获得有三个文件缓存
authz: 权限控制,哪些用户能够访问哪些文件服务器
passed: 设置用户和密码的less
svnserve.conf: 设置svn相关的操做ide
### 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] # harry = harryssecret # sally = sallyssecret xiajun=123456 lisi=12
这样咱们就创建了xiajun用户, 123456密码 ,lisi用户,12密码svn
### - an alias defined in a special [aliases] section, ### - all authenticated users, using the '$authenticated' token, ### - only anonymous users, using the '$anonymous' token, ### - anyone, using the '*' wildcard. ### ### A match can be inverted by prefixing the rule with '~'. Rules can ### grant read ('r') access, read-write ('rw') access, or no access ### (''). [aliases] # joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average [groups] # harry_and_sally = harry,sally # harry_sally_and_joe = harry,sally,&joe team0=xiajun team1=lisi #xiajun在team0组 #lisi在team1组 # [/foo/bar] # harry = rw # &joe = r # * = # [repository:/baz/fuz] # @harry_and_sally = rw # * = r # [repo0:/] @team0=rw @team1=r # 第一个小组有读写的权限,第二个小组只有读取的权限
[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 = read #没有登陆的用户不能访问 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 #密码文件为当前目录下的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 #验证权限文件为当前目录下的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 =/home/svn/repo0 # 认证命名空间,subversion会在认证提示里显示,而且做为凭证缓存的关键字。 [sasl] ### This option specifies whether you want to use the Cyrus SASL ### library for authentication. Default is false. ### This section will be ignored if svnserve is not built with Cyrus ### SASL support; to check, run 'svnserve --version' and look for a line ### reading 'Cyrus SASL authentication is available.' # use-sasl = true ### These options specify the desired strength of the security layer ### that you want SASL to provide. 0 means no encryption, 1 means ### integrity-checking only, values larger than 1 are correlated ### to the effective key length for encryption (e.g. 128 means 128-bit ### encryption). The values below are the defaults. # min-encryption = 0 # max-encryption = 256
采用默认配置. 以上语句都必须顶格写, 左侧不能留空格, 不然会出错.ui
好了,经过以上配置,你的svn就能够了。this
启动svnserve -d -r /home/svn/repo0
能够看获得该版本库的svn服务器已经启动了。spa
$ mkdir myproject $ mkdir myproject/trunk $ mkdir myproject/branches $ mkdir myproject/tags svn import myproject svn://192.168.1.109/repo0/MyProject -m "first import project"
注意必定要导入工程到这个版本库里,repo0只是一个仓库,仓库里面要放项目
建议在windows下采用TortoiseSVN, 链接地址为: svn://your server address (若是指定端口须要添加端口 :端口号)
svn://172.16.81.106/repo0/myproject
能够看获得已经检出了
后面使用svn上传,修改,删除均可以使用TortoiseSVN操做,比较简单。