linux服务器下搭建svn服务器仓库

在已经搭建好svn服务器的前提下,我们进入创建svn仓库环节。

1,创建仓库

语法:svnadmin create 目录(你想将仓库创建的位置目录)

示例:我想在/home下新建demo仓库

cd /home

mkdir svn

svnadmin create /home/svn/demo

 

仓库创建成功以后,会出现一个仓库名字的文件夹 文件夹下面有以下几个文件和目录

ll /home/svn/demo
conf
db
format
hooks
locks
README.txt

打开conf文件夹

ll conf
authz
passwd
svnserve.conf

2,修改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

#此处开始添加
#添加用户名和密码 用户 = 密码
admin = 123

authz文件修改

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe

# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

#此处开始添加
#此处配置用户权限 权限可以是w、r、rw和空,空表示没有任何权限。*表示全部用户。这里给admin可读可写的权限

[/]
admin = rw

svnserve.conf文件修改

svnserve.conf文件里修改五个位置,根据需要配置anon-access,auth-access,password-db,authz-db,realm的值

[general]
### The anon-access and auth-access options control access to the
### repository for unauthenticated (a.k.a. anonymous) users and
### authenticated users, respectively.
### Valid values are "write", "read", and "none".
### Setting the value to "none" prohibits both reading and writing;
### "read" allows read-only access, and "write" allows complete 
### read/write access to the repository.
### The sample settings below are the defaults and specify that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.

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/demo #修改,将#去掉   realm的值为本仓库的目录路径

### The force-username-case option causes svnserve to case-normalize
### usernames before comparing them against the authorization rules in the
### authz-db file configured above.  Valid values are "upper" (to upper-
### case the usernames), "lower" (to lowercase the usernames), and
### "none" (to compare usernames as-is without case conversion, which
### is the default behavior).
# force-username-case = none

3,启动svn服务

正常启动命令:svnserve -d -r svn仓库目录         示例:svnserve -d -r /home/svn/demo

由于我的服务器对外开放的端口有限,svn的默认端口并没有打开,那我就采取了更改svn端口号方式启动(在启动命令后加上所开放的端口号),如果你的服务器默认端口对外开放正常启动就行:

svnserve -d -r /home/svn/demo --listen-port 8448 

如果启动提示svnserve: Can't bind server socket: Address already in use,是由于在这之前已经启动了svn。

查看svn进程 :ps -ef|grep svn

4,访问svn服务

使用svn客户端 输入地址:示例:svn://192.168.43.65:8448/demo     (提醒:这个地址输入的端口号为我们刚刚启动时更改的端口号。若存在端口映射关系比如 18448 --> 8448     那我们地址里填的端口号为18448)

参考文章:https://blog.csdn.net/xinyflove/article/details/88942933

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值