Subversion是一个版本控制系统,相对于的RCS、CVS,采用了分支管理系统,它的设计目标就是取代CVS。互联网上免费的版本控制服务多基于Subversion。
Subversion的版本库可以通过网络访问,从而使用户可以在不同的电脑上进行操作。从某种程度上来说,允许用户在各自的空间里修改和管理同一组数据可以促进团队协作。因为修改不再是单线进行(单线进行也就是必须一个一个进行),开发进度会进展迅速。此外,由于所有的工作都已版本化,也就不必担心由于错误的更改而影响软件质量—如果出现不正确的更改,只要撤销那一次更改操作即可。某些版本控制系统本身也是软件配置管理系统(SCM),这种系统经过精巧的设计,专门用来管理源代码树,并且具备许多与软件开发有关的特性——比如对编程语言的支持或者提供程序构建工具。不过Subversion并不是这样的系统,它是一个通用系统,可以管理任何类型的文件集。
查看当前环境是否有安装SVN服务
# rpm -qa subversion
使用yum命令进行SVN服务的安装
yum -y install subversion
创建SVN文件夹
mkdir -p /opt/svn/repos/svn1
创建SVN版本库
svnadmin create /opt/svn/repos/svn1
修改SVN配置文件
# vim /opt/svn/repos/svn1/conf/svnserve.conf
### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository. (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)
### Visit http://subversion.tigris.org/ for more information.
[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 = My First Repository
创建svn用户和权限分配
passwd 此文件配置用户账号和密码
# vim /opt/svn/repos/svn1/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
username = userpassword
username为用户名 userpassword为用户密码
authz 此文件配置用户权限
启动SVN进程
svnserve -d -r /opt/svn/repos #注意目录,不包含svn1
查看进程
netstat –apn | grep svnserve
ps aux | grep svnserve #查看服务是否启动
测试SVN服务器是否正常连接,默认情况下SVN服务器开启3690
svn://192.168.1.1/svn1
如果CentOS服务器有开启防火墙和selinux状态,请进行关闭
将3690端口规则添加到防火墙
# service iptables status //查看防火墙状态
vi /etc/sysconfig/iptables
-A INPUT -p tcp -m tcp --dport 3690 -j ACCEPT
# service iptables stop //关闭防火墙
# service iptables start //开启防火墙
# vim /etc/selinux/config //配置selinux状态
Subversion的版本库可以通过网络访问,从而使用户可以在不同的电脑上进行操作。从某种程度上来说,允许用户在各自的空间里修改和管理同一组数据可以促进团队协作。因为修改不再是单线进行(单线进行也就是必须一个一个进行),开发进度会进展迅速。此外,由于所有的工作都已版本化,也就不必担心由于错误的更改而影响软件质量—如果出现不正确的更改,只要撤销那一次更改操作即可。某些版本控制系统本身也是软件配置管理系统(SCM),这种系统经过精巧的设计,专门用来管理源代码树,并且具备许多与软件开发有关的特性——比如对编程语言的支持或者提供程序构建工具。不过Subversion并不是这样的系统,它是一个通用系统,可以管理任何类型的文件集。
查看当前环境是否有安装SVN服务
# rpm -qa subversion
使用yum命令进行SVN服务的安装
yum -y install subversion
创建SVN文件夹
mkdir -p /opt/svn/repos/svn1
创建SVN版本库
svnadmin create /opt/svn/repos/svn1
修改SVN配置文件
# vim /opt/svn/repos/svn1/conf/svnserve.conf
### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository. (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)
### Visit http://subversion.tigris.org/ for more information.
[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 = My First Repository
创建svn用户和权限分配
passwd 此文件配置用户账号和密码
# vim /opt/svn/repos/svn1/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
username = userpassword
username为用户名 userpassword为用户密码
authz 此文件配置用户权限
启动SVN进程
svnserve -d -r /opt/svn/repos #注意目录,不包含svn1
查看进程
netstat –apn | grep svnserve
ps aux | grep svnserve #查看服务是否启动
测试SVN服务器是否正常连接,默认情况下SVN服务器开启3690
svn://192.168.1.1/svn1
如果CentOS服务器有开启防火墙和selinux状态,请进行关闭
将3690端口规则添加到防火墙
# service iptables status //查看防火墙状态
vi /etc/sysconfig/iptables
-A INPUT -p tcp -m tcp --dport 3690 -j ACCEPT
# service iptables stop //关闭防火墙
# service iptables start //开启防火墙
# vim /etc/selinux/config //配置selinux状态