Subversion是一個(gè)版本控制系統(tǒng),相對(duì)于的RCS、CVS,采用了分支管理系統(tǒng),它的設(shè)計(jì)目標(biāo)就是取代CVS?;ヂ?lián)網(wǎng)上免費(fèi)的版本控制服務(wù)多基于Subversion。
Subversion的版本庫可以通過網(wǎng)絡(luò)訪問,從而使用戶可以在不同的電腦上進(jìn)行操作。從某種程度上來說,允許用戶在各自的空間里修改和管理同一組數(shù)據(jù)可以促進(jìn)團(tuán)隊(duì)協(xié)作。因?yàn)樾薷牟辉偈菃尉€進(jìn)行(單線進(jìn)行也就是必須一個(gè)一個(gè)進(jìn)行),開發(fā)進(jìn)度會(huì)進(jìn)展迅速。此外,由于所有的工作都已版本化,也就不必?fù)?dān)心由于錯(cuò)誤的更改而影響軟件質(zhì)量—如果出現(xiàn)不正確的更改,只要撤銷那一次更改操作即可。某些版本控制系統(tǒng)本身也是軟件配置管理系統(tǒng)(SCM),這種系統(tǒng)經(jīng)過精巧的設(shè)計(jì),專門用來管理源代碼樹,并且具備許多與軟件開發(fā)有關(guān)的特性——比如對(duì)編程語言的支持或者提供程序構(gòu)建工具。不過Subversion并不是這樣的系統(tǒng),它是一個(gè)通用系統(tǒng),可以管理任何類型的文件集。
查看當(dāng)前環(huán)境是否有安裝SVN服務(wù)
# rpm -qa subversion
使用yum命令進(jìn)行SVN服務(wù)的安裝
yum -y install subversion
創(chuàng)建SVN文件夾
mkdir -p /opt/svn/repos/svn1
創(chuàng)建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
創(chuàng)建svn用戶和權(quán)限分配
passwd 此文件配置用戶賬號(hào)和密碼
# 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 此文件配置用戶權(quán)限
啟動(dòng)SVN進(jìn)程
svnserve -d -r /opt/svn/repos #注意目錄,不包含svn1
查看進(jìn)程
netstat –apn | grep svnserve
ps aux | grep svnserve #查看服務(wù)是否啟動(dòng)
測(cè)試SVN服務(wù)器是否正常連接,默認(rèn)情況下SVN服務(wù)器開啟3690
svn://192.168.1.1/svn1
如果CentOS服務(wù)器有開啟防火墻和selinux狀態(tài),請(qǐng)進(jìn)行關(guān)閉
將3690端口規(guī)則添加到防火墻
# service iptables status //查看防火墻狀態(tài)
vi /etc/sysconfig/iptables
-A INPUT -p tcp -m tcp --dport 3690 -j ACCEPT
# service iptables stop //關(guān)閉防火墻
# service iptables start //開啟防火墻
# vim /etc/selinux/config //配置selinux狀態(tài)
Subversion的版本庫可以通過網(wǎng)絡(luò)訪問,從而使用戶可以在不同的電腦上進(jìn)行操作。從某種程度上來說,允許用戶在各自的空間里修改和管理同一組數(shù)據(jù)可以促進(jìn)團(tuán)隊(duì)協(xié)作。因?yàn)樾薷牟辉偈菃尉€進(jìn)行(單線進(jìn)行也就是必須一個(gè)一個(gè)進(jìn)行),開發(fā)進(jìn)度會(huì)進(jìn)展迅速。此外,由于所有的工作都已版本化,也就不必?fù)?dān)心由于錯(cuò)誤的更改而影響軟件質(zhì)量—如果出現(xiàn)不正確的更改,只要撤銷那一次更改操作即可。某些版本控制系統(tǒng)本身也是軟件配置管理系統(tǒng)(SCM),這種系統(tǒng)經(jīng)過精巧的設(shè)計(jì),專門用來管理源代碼樹,并且具備許多與軟件開發(fā)有關(guān)的特性——比如對(duì)編程語言的支持或者提供程序構(gòu)建工具。不過Subversion并不是這樣的系統(tǒng),它是一個(gè)通用系統(tǒng),可以管理任何類型的文件集。
查看當(dāng)前環(huán)境是否有安裝SVN服務(wù)
# rpm -qa subversion
使用yum命令進(jìn)行SVN服務(wù)的安裝
yum -y install subversion
創(chuàng)建SVN文件夾
mkdir -p /opt/svn/repos/svn1
創(chuàng)建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
創(chuàng)建svn用戶和權(quán)限分配
passwd 此文件配置用戶賬號(hào)和密碼
# 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 此文件配置用戶權(quán)限
啟動(dòng)SVN進(jìn)程
svnserve -d -r /opt/svn/repos #注意目錄,不包含svn1
查看進(jìn)程
netstat –apn | grep svnserve
ps aux | grep svnserve #查看服務(wù)是否啟動(dòng)
測(cè)試SVN服務(wù)器是否正常連接,默認(rèn)情況下SVN服務(wù)器開啟3690
svn://192.168.1.1/svn1
如果CentOS服務(wù)器有開啟防火墻和selinux狀態(tài),請(qǐng)進(jìn)行關(guān)閉
將3690端口規(guī)則添加到防火墻
# service iptables status //查看防火墻狀態(tài)
vi /etc/sysconfig/iptables
-A INPUT -p tcp -m tcp --dport 3690 -j ACCEPT
# service iptables stop //關(guān)閉防火墻
# service iptables start //開啟防火墻
# vim /etc/selinux/config //配置selinux狀態(tài)