CentOS 创建svn服务器
2015-06-05 21:34
435 查看
一、安装Subversion
#yum install subversion
1.查看安装时的文件产生情况,使用 rpm -ql subversion
2.卸载subversion:#yum remove subversion
3.停止subversion服务:#killall svnserve
二、创建仓库(以创建多个仓库为例)
#svnadmin create /var/svn/demo
#svnadmin create /var/svn/test
/var/svn/demo和/var/svn/test为所创建仓库的路径,理论上可以是任何目录。这里我取/var/svn为所有仓库的总路径,在目录下面分别创建仓库。
三、配置仓库
针对每个仓库单独配置,分别修改每个仓库conf目录下面的三个配置文件(authz、passwd、svnserve.conf)
1.修改authz文件,这个配置文件里面可以设置用户组和用户目录权限
==============================
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
admin = admin,user1,user2
# [/foo/bar]
# harry = rw
# &joe = r
# * =
[/]
@admin = rw
* =
==============================
上面绿色部分是我配置的内容,第一行绿色的是配置一个用户组admin 有成员admin和novalue两个;第二行绿色的开始配置目录权限,设置admin组(前面加@符号)的权限为读写权限,其他成员没有权限(* = )
2.修改passwd文件,设置访问当前仓库的用户和密码
===========================================
[users]
# harry = harryssecret
# sally = sallyssecret
admin = 123456
user1 = 123456
user2 = 123456
===========================================
3.修改svnserve.conf文件,开启权限控制等功能
找到第一个常规选项[general],把前面是一个#号的去掉#号,如下是我的demo仓库配置内容
===========================================================================
[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 = none
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 = demo's svndata
==========================================================================
注意:所有的行都必须顶格,否则报错。
四、启动和关闭服务
1.启动服务
#svnserve -d -r /var/svn --listen-host 192.168.1.16
命令中/var/svn是我所有仓库的所在的根目录,如果单个仓库,可以直接写仓库地址即可,比如启动demo仓库,#svnserve -d -r /var/svn/demo --listen-host 192.168.1.16
2.停止服务
#killall svnserve
五、访问仓库项目
我们有两个代码仓库/var/svn/demo 和/var/svn/test,那么在客户端访问时可以用
svn://192.168.1.16/demo
svn://192.168.1.16/test
来分别访问两个项目
六、开放服务器端口(可选)
svn默认端口是3690,如果你设置了防火墙,你需要在防火墙上开放这个端口。
例如iptables下设置:
/sbin/iptables -A INPUT -i eth0 -p tcp --dport 3690 -j ACCEPT
/sbin/service iptables save
#yum install subversion
1.查看安装时的文件产生情况,使用 rpm -ql subversion
2.卸载subversion:#yum remove subversion
3.停止subversion服务:#killall svnserve
二、创建仓库(以创建多个仓库为例)
#svnadmin create /var/svn/demo
#svnadmin create /var/svn/test
/var/svn/demo和/var/svn/test为所创建仓库的路径,理论上可以是任何目录。这里我取/var/svn为所有仓库的总路径,在目录下面分别创建仓库。
三、配置仓库
针对每个仓库单独配置,分别修改每个仓库conf目录下面的三个配置文件(authz、passwd、svnserve.conf)
1.修改authz文件,这个配置文件里面可以设置用户组和用户目录权限
==============================
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
admin = admin,user1,user2
# [/foo/bar]
# harry = rw
# &joe = r
# * =
[/]
@admin = rw
* =
==============================
上面绿色部分是我配置的内容,第一行绿色的是配置一个用户组admin 有成员admin和novalue两个;第二行绿色的开始配置目录权限,设置admin组(前面加@符号)的权限为读写权限,其他成员没有权限(* = )
2.修改passwd文件,设置访问当前仓库的用户和密码
===========================================
[users]
# harry = harryssecret
# sally = sallyssecret
admin = 123456
user1 = 123456
user2 = 123456
===========================================
3.修改svnserve.conf文件,开启权限控制等功能
找到第一个常规选项[general],把前面是一个#号的去掉#号,如下是我的demo仓库配置内容
===========================================================================
[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 = none
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 = demo's svndata
==========================================================================
注意:所有的行都必须顶格,否则报错。
四、启动和关闭服务
1.启动服务
#svnserve -d -r /var/svn --listen-host 192.168.1.16
命令中/var/svn是我所有仓库的所在的根目录,如果单个仓库,可以直接写仓库地址即可,比如启动demo仓库,#svnserve -d -r /var/svn/demo --listen-host 192.168.1.16
2.停止服务
#killall svnserve
五、访问仓库项目
我们有两个代码仓库/var/svn/demo 和/var/svn/test,那么在客户端访问时可以用
svn://192.168.1.16/demo
svn://192.168.1.16/test
来分别访问两个项目
六、开放服务器端口(可选)
svn默认端口是3690,如果你设置了防火墙,你需要在防火墙上开放这个端口。
例如iptables下设置:
/sbin/iptables -A INPUT -i eth0 -p tcp --dport 3690 -j ACCEPT
/sbin/service iptables save
相关文章推荐
- Win7+CentOS 7双系统启动顺序修改方法.
- Win7+CentOS 7双系统启动顺序修改方法.
- linux下一个C语言flock功能使用 .
- Linux 目录流管理
- Linux 文件流与目录流管理
- Linux内部指令及Java编译配置
- mpi 调试
- Linux操作系统基础
- linux 常用命令
- CentOs中mysql的安装与配置(转)
- linux内核使用的一些算法和思想(个人总结)
- Linux地址映射
- Linux通信机制(2)消息队列和信号量
- Linux下的管道编程技术
- CentOS安装PostgreSQL数据库
- Scala2.10.4在CentOS7中的安装与配置
- forlinux6410ARM学习02期--PC+Linux+ARM操作合集
- mac svn命令 linux同样适用
- Jdk1.8在CentOS7中的安装与配置
- lrzsz在CentOS7的安装