Linux
Centos下创建SVN仓库
本教程将在Centos下创建SVN仓库,并现实代码控制
本教程将教大家在Centos下如何创建一个新的仓库并实现代码控制。
首页进入到我们先要创建仓库的目录,根据个人情况定义,代码如下:
cd /home/svn
进入仓库目录后,创建一个仓库,代码如下:
svnadmin create svntest
之后在目录下便会有一个svntest的目录,如果没有则创建失败。
创建完仓库后,便开始进行基础配置设置,首先进入我们创建仓库配置目录中,代码如下:
cd svntest/conf
在该目录中有3个文件,分别是authz(权限文件)、passwd(密码文件)、svnserve.conf(服务器文件),首页我们先进行账户、密码配置,编辑passwd文件,配置帐户名、密码,配置如下
### 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 test = test
在这里我们配置了用户名为test、密码为test,然后我们再来配置svnserve.conf文件,截图如下
[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 ### 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 ### 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/svntest
我们需要将anon-access、password-db、realm取消注释,并配置相应配置,这样我们便成功完成配置。
最后我们配置权限配置,编辑authz,配置如下:
### 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, ### - a group of users defined in a special [groups] section, ### - 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 admins = test # [/foo/bar] # harry = rw # &joe = r # * = # [repository:/baz/fuz] # @harry_and_sally = rw # * = r [svntest:/] @admins = rw * =
我们分别添加了一个用户组admins,配置我们创建的仓库svntest允许访问的用户组,这样我们便完成了一个仓库的全部配置。
如果还没启动svn服务,我们输入以下命令行启动svn服务
svnserve -d -r /home/svn
然后我们在本地电脑便可以通过服务器IP地址/svntest连接我们的仓库。这样我们便成功的在Centos下创建仓库,并进行代码的控制。
0条评论