Subversion是一個版本控制系統,相對于的RCS、CVS,采用了分支管理系統,它的設計目標就是取代CVS?;ヂ摼W上免費的版本控制服務多基于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狀態