CentOS安装和部署SVN服务器

1、安装SVN

通过yum安装svn

[root@localhost webber]# yum install subversion

查看svn是否安装成功

[root@localhost webber]# svn --version
svn, version 1.7.14 (r1542130)
   compiled Apr 11 2018, 02:40:28

Copyright (C) 2013 The Apache Software Foundation.

2、配置版本库 

修改svn的默认数据根目录/var/svn,也可以不修改,此处我将数据根目录设置为/home/svn

[root@localhost home]# vi /etc/sysconfig/svnserve

# OPTIONS is used to pass command-line arguments to svnserve.
#
# Specify the repository location in -r parameter:
OPTIONS="-r /home/svn"

创建自己的版本库

[root@localhost home]# svnadmin create /home/svn/webber

配置版本库的用户名和密码,"用户名" = "密码"

[root@localhost home]# vi /home/svn/webber/conf/passwd
[users]
# harry = harryssecret
# sally = sallyssecret
webber = 123456

配置版本库的权限

[root@localhost home]# vi /home/svn/webber/conf/authz

在文件末尾加上用户的权限,如webber版本库根目录的读写权限

[webber:/]
webber = rw

修改版本库的配置

[root@localhost home]# vi /home/svn/webber/conf/svnserve.conf
[general]
anon-access = none                     #控制非鉴权用户访问版本库的权限
auth-access = write                    #控制鉴权用户访问版本库的权限
password-db = passwd                   #指定用户名口令文件名
authz-db = authz                       #指定权限配置文件名
realm = /home/svn/webber               #指定版本库的认证域,即在登录时提示的认证域名称

所有配置均已经完成,最后一步,启用版本库

[root@localhost home]# svnserve -d -r /home/svn/

3、使用版本库

然后checkout试试能否成功更新版本库webber

[root@localhost webber]# svn checkout svn://192.168.0.108/webber
Authentication realm: <svn://192.168.0.108:3690> /home/svn/webber
Password for 'root': 
Authentication realm: <svn://192.168.0.108:3690> /home/svn/webber
Username: webber
Password for 'webber': 

-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <svn://192.168.0.108:3690> /home/svn/webber

can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes
Checked out revision 0.
[root@localhost webber]# ll
total 0
drwxr-xr-x. 3 root root  18 Jul 15 01:07 webber

 

posted @ 2018-07-14 18:03  成都张哥  阅读(1206)  评论(0编辑  收藏  举报