Linux系统SVN服务器搭建

第一步:通过yum命令安装svnserve,命令如下:

>yum -y install subversion

第二步:创建版本库目录(此仅为目录,为后面创建版本库提供存放位置)
选择在var路径下创建版本库,当前处于根目录下,一次性创建如下:
>mkdir -p /var/svn/svnrepos
第三步:创建svn版本库
在第二步建立的路径基础上,创建版本库,命令如下:
>svnadmin create /var/svn/svnrepos/hww   (hww为你预期的版本库名称,可自定义)
创建成功后,进入hww目录下
>cd /var/svn/svnrepos/hww
进入目录,可以看见如下文件信息:
[root@SVN1 hww]# ll
total 8
drwxr-xr-x. 2 root root 54 Feb 24 03:39 conf
drwxr-sr-x. 6 root root 253 Feb 25 19:31 db
-r--r--r--. 1 root root 2 Feb 24 03:13 format
drwxr-xr-x. 2 root root 231 Feb 24 03:13 hooks
drwxr-xr-x. 2 root root 41 Feb 24 03:13 locks
-rw-r--r--. 1 root root 229 Feb 24 03:13 README.txt
第四步:配置修改
进入已经创建好的版本库目录下,也就是前文说创建的hww
进入conf
>cd /var/svn/svnrepos/hww/conf
conf目录下,一共存放三份重要的配置文件,如下:
[root@SVN1 hww]# cd conf/
[root@SVN1 conf]# ll
total 12
-rw-r--r--. 1 root root 1132 Feb 24 03:39 authz
-rw-r--r--. 1 root root 373 Feb 24 03:18 passwd
-rw-r--r--. 1 root root 3077 Feb 24 03:38 svnserve.conf 
authz:负责账号权限的管理,控制账号是否读写权限
passwd:负责账号和密码的用户名单管理
svnserve.conf:svn服务器配置文件
修改authz文件信息,如下:
>vi 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
[/]
test1 = rw
test2 = rw
rw表示赋予此账号可读写的权限,请注意[]中的斜杠,有些教程说,需添加版本库名称在括号内,我直接建议就这写,这样写允许访问的权限更大,避免一些错误
修改passwd文件信息
>vi passwd
账号密码文件无需做修改,也是直接将账号和密码信息追加到文件中即可,注意格式为:
账号 = 密码
例如:
test1 = 123456

test2 = 123456

修改svnserve.conf(重要)
vi svnserve.conf
原始文件内容,都被注释掉的,我们只需要去掉4条指定内容前注释即可,如下:
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 =/var/svn/svnrepos 
到此,配置已经全部完成,账号信息已经添加成功
第五步:防火墙开启
多数情况下服务器安装完成,配置完成后,无法连接svn服务器,均是防火墙问题

Centos6.5:

查看防火墙状态:service iptables status
关闭防火墙:service iptables stop 重启后失效 即时生效
开启:service iptables start 重启后失效 即时生效
永久关闭防火墙:chkconfig iptables off 重启后生效
永久开启防火墙:chkconfig iptables on 重启后生效

Centos7:

centos7使用传统方式关闭防火墙:
1.systemctl stop firewalld  
2.systemctl mask firewalld
3.并且安装iptables-services: yum install iptables-services 
4.设置开机启动: systemctl enable iptables 
5.systemctl stop iptables  
6.systemctl start iptables  
7.systemctl restart iptables  
8.systemctl reload iptables
9.保存设置: service iptables save
六:启动svn服务器
在跟目录下,执行如下命令:
>svnserve -d -r /var/svn/svnrepos
启动成功后,可用ps -aux查看服务启动是否成功
七:客户端访问svn服务器
在windows客户端 (没有可以下载安装一个 TortoiseSVN ) ,输入地址:svn://ip地址:3690/hww   (iP地址为你linux的ip,xxxx为前文创建的版本库名称,3690为svn默认端口)
弹出输入用户名和密码,输入即可访问

参考:



  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值