CentOS 搭建 SVN

一花鹅、安裝 SVN

1. 通過(guò) yum 下載并安裝

yum install subversion

[root@izbp11tfz245ne0doug99kz ~]# yum install subversion

2. 查看 SVN 版本

svnserve --version

[root@izbp11tfz245ne0doug99kz ~]# svnserve --version

3. 查看 SVN 安裝目錄

rpm -ql subversion

[root@izbp11tfz245ne0doug99kz ~]# rpm -ql subversion

二躲舌、SVN 版本庫(kù)

1. 創(chuàng)建版本庫(kù)目錄

mkdir /var/svnrepos

為后面創(chuàng)建版本庫(kù)提供存放位置萨脑。

[root@izbp11tfz245ne0doug99kz ~]# mkdir /var/svnrepos

2. 創(chuàng)建版本庫(kù)

svnadmin create --fs-type fsfs /var/svnrepos/svn0

指定版本庫(kù)存放的文件結(jié)構(gòu)头朱,有 fsfs 和 dbd虚青,推薦使用 fsfs涩咖。

[root@izbp11tfz245ne0doug99kz ~]# svnadmin create --fs-type fsfs /var/svnrepos/svn0

3. 復(fù)制版本庫(kù)配置文件到根目錄

(1) 復(fù)制用戶賬戶權(quán)限管理配置文件

cp /var/svnrepos/svn0/conf/authz /var/svnrepos/conf/

[root@izbp11tfz245ne0doug99kz ~]# cp /var/svnrepos/svn0/conf/authz /var/svnrepos/conf/
(2) 復(fù)制用戶賬號(hào)密碼管理配置文件

cp /var/svnrepos/svn0/conf/passwd /var/svnrepos/conf/

[root@izbp11tfz245ne0doug99kz ~]# cp /var/svnrepos/svn0/conf/passwd /var/svnrepos/conf/

三绸栅、編輯版本庫(kù)管理及配置文件

1. /var/svnrepos/conf/authz

用戶賬號(hào)權(quán)限管理级野。

修改內(nèi)容:
[/]
USER1 = rw
USER2 = rw
完整配置文件內(nèi)容:

### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').

[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[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

[/]
USER1 = rw
USER2 = rw

2. /var/svnrepos/conf/passwd

用戶賬號(hào)密碼管理。

修改內(nèi)容:
USER1 = PASSWORD1
USER2 = PASSWORD2
完整配置文件內(nèi)容:

### 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
USER1 = PASSWORD1
USER2 = PASSWORD2

3. /var/svnrepos/svn0/conf/svnserve.conf

配置文件阴幌。

修改內(nèi)容:
anon-access = none

禁止匿名用戶訪問(wèn)勺阐。

auth-access = write

授權(quán)用戶擁有讀寫權(quán)限。

password-db = ../../conf/passwd

以相對(duì)路徑指定用戶賬號(hào)密碼管理文件矛双。

authz-db = ../../conf/authz

以相對(duì)路徑指定用戶賬號(hào)權(quán)限管理文件渊抽。

realm = My First Repository

指定認(rèn)證域,默認(rèn)為/var/svnrepos目錄议忽。

完整配置文件內(nèi)容:

### 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.apache.org/ for more information.

[general]
### The anon-access and auth-access options control access to the
### repository for unauthenticated (a.k.a. anonymous) users and
### authenticated users, respectively.
### Valid values are "write", "read", and "none".
### Setting the value to "none" prohibits both reading and writing;
### "read" allows read-only access, and "write" allows complete
### read/write access to the repository.
### The sample settings below are the defaults and specify that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
# anon-access = read
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
password-db = ../../conf/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
authz-db = ../../conf/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
### The force-username-case option causes svnserve to case-normalize
### usernames before comparing them against the authorization rules in the
### authz-db file configured above.  Valid values are "upper" (to upper-
### case the usernames), "lower" (to lowercase the usernames), and
### "none" (to compare usernames as-is without case conversion, which
### is the default behavior).
# force-username-case = none

[sasl]
### This option specifies whether you want to use the Cyrus SASL
### library for authentication. Default is false.
### This section will be ignored if svnserve is not built with Cyrus
### SASL support; to check, run 'svnserve --version' and look for a line
### reading 'Cyrus SASL authentication is available.'
# use-sasl = true
### These options specify the desired strength of the security layer
### that you want SASL to provide. 0 means no encryption, 1 means
### integrity-checking only, values larger than 1 are correlated
### to the effective key length for encryption (e.g. 128 means 128-bit
### encryption). The values below are the defaults.
# min-encryption = 0
# max-encryption = 256

四懒闷、啟動(dòng) SVN

方法2選1:

1. 使用 systemctl 命令啟動(dòng)

(1) 修改啟動(dòng)相關(guān)文件

/etc/sysconfig/svnserve
修改內(nèi)容:
# OPTIONS="-r /var/svn"
OPTIONS="-r /var/svnrepos"

/var/svn 為默認(rèn) SVN 版本庫(kù)根目錄,如果不修改栈幸,使用 systemctl start svnserve.service 命令愤估,系統(tǒng)將判斷根目錄不存在,無(wú)法啟動(dòng)速址。

完整配置文件內(nèi)容:

# OPTIONS is used to pass command-line arguments to svnserve.
#
# Specify the repository location in -r parameter:
# OPTIONS="-r /var/svn"
OPTIONS="-r /var/svnrepos"
(2) 手動(dòng)啟動(dòng)

systemctl start svnserve.service

[root@izbp11tfz245ne0doug99kz ~]# systemctl start svnserve.service
(3) 設(shè)置開機(jī)自啟動(dòng)

systemctl enable svnserve.service

[root@izbp11tfz245ne0doug99kz ~]# systemctl enable svnserve.service
Created symlink from /etc/systemd/system/multi-user.target.wants/svnserve.service to /usr/lib/systemd/system/svnserve.service.

2. 使用 svnserve 命令啟動(dòng)

(1) 手工啟動(dòng)

svnserve -d -r /var/svnrepos/

可以帶上 --listen-port 參數(shù)指定端口號(hào)玩焰,默認(rèn)為 3690。

[root@izbp11tfz245ne0doug99kz ~]# svnserve -d -r /var/svnrepos/
(2) 修改開機(jī)自啟動(dòng)文件

/etc/rc.local
修改內(nèi)容:
svnserve -d -r /var/svnrepos/
完整配置文件內(nèi)容:

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local

svnserve -d -r /var/svnrepos/

賦予 /etc/rc.d/rc.local 執(zhí)行權(quán)限
chmod +x /etc/rc.d/rc.local

[root@izbp11tfz245ne0doug99kz ~]# chmod +x /etc/rc.d/rc.local

3. 查看進(jìn)程狀態(tài)

ps -aux | grep 'svnserve'

[root@izbp11tfz245ne0doug99kz ~]# ps -aux | grep 'svnserve'
root     13681  0.0  0.0 162196   436 ?        Ss   21:00   0:00 svnserve -d -r                                                                                       /var/svnrepos/
root     13695  0.0  0.1 112656  2312 pts/2    S+   21:01   0:00 grep --color=a                                                                                      uto svnserve

4. 查看進(jìn)程端口

netstat -ln | grep 3690

[root@izbp11tfz245ne0doug99kz ~]# netstat -ln | grep 3690
tcp        0      0 0.0.0.0:3690            0.0.0.0:*               LISTEN

五芍锚、訪問(wèn) SVN

1. 下載客戶端和中文語(yǔ)言包

SVN官網(wǎng)下載

2. 安裝客戶端

(1) 歡迎界面
點(diǎn)擊Next進(jìn)入下一步
(2) 許可界面
點(diǎn)擊Next進(jìn)入下一步
(3) 功能路徑界面
點(diǎn)擊command line client tools昔园,選擇Will be installed on local hard drive

修改路徑后點(diǎn)擊Next進(jìn)入下一步
(4) 安裝前確認(rèn)
點(diǎn)擊Next進(jìn)入下一步
(5) 安裝完畢
點(diǎn)擊Finish完成

3. 安裝中文語(yǔ)言包

(1) 歡迎界面
點(diǎn)擊下一步后自動(dòng)安裝
(2) 安裝完畢
點(diǎn)擊完成
(3) 設(shè)置中文語(yǔ)言
Language選擇中文(簡(jiǎn)體)(中文),然后點(diǎn)應(yīng)用和確定

2. 訪問(wèn)

svn://IP地址:端口號(hào)/版本庫(kù)
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末并炮,一起剝皮案震驚了整個(gè)濱河市默刚,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌逃魄,老刑警劉巖荤西,帶你破解...
    沈念sama閱讀 222,464評(píng)論 6 517
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異伍俘,居然都是意外死亡邪锌,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,033評(píng)論 3 399
  • 文/潘曉璐 我一進(jìn)店門癌瘾,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)秃流,“玉大人,你說(shuō)我怎么就攤上這事柳弄〔罢停” “怎么了概说?”我有些...
    開封第一講書人閱讀 169,078評(píng)論 0 362
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)嚣伐。 經(jīng)常有香客問(wèn)我糖赔,道長(zhǎng),這世上最難降的妖魔是什么轩端? 我笑而不...
    開封第一講書人閱讀 59,979評(píng)論 1 299
  • 正文 為了忘掉前任放典,我火速辦了婚禮,結(jié)果婚禮上基茵,老公的妹妹穿的比我還像新娘奋构。我一直安慰自己,他們只是感情好拱层,可當(dāng)我...
    茶點(diǎn)故事閱讀 69,001評(píng)論 6 398
  • 文/花漫 我一把揭開白布弥臼。 她就那樣靜靜地躺著,像睡著了一般根灯。 火紅的嫁衣襯著肌膚如雪径缅。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 52,584評(píng)論 1 312
  • 那天烙肺,我揣著相機(jī)與錄音纳猪,去河邊找鬼。 笑死桃笙,一個(gè)胖子當(dāng)著我的面吹牛氏堤,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播搏明,決...
    沈念sama閱讀 41,085評(píng)論 3 422
  • 文/蒼蘭香墨 我猛地睜開眼鼠锈,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了熏瞄?” 一聲冷哼從身側(cè)響起脚祟,我...
    開封第一講書人閱讀 40,023評(píng)論 0 277
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤谬以,失蹤者是張志新(化名)和其女友劉穎强饮,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體为黎,經(jīng)...
    沈念sama閱讀 46,555評(píng)論 1 319
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡邮丰,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,626評(píng)論 3 342
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了铭乾。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片剪廉。...
    茶點(diǎn)故事閱讀 40,769評(píng)論 1 353
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖炕檩,靈堂內(nèi)的尸體忽然破棺而出斗蒋,到底是詐尸還是另有隱情捌斧,我是刑警寧澤,帶...
    沈念sama閱讀 36,439評(píng)論 5 351
  • 正文 年R本政府宣布泉沾,位于F島的核電站捞蚂,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏跷究。R本人自食惡果不足惜姓迅,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 42,115評(píng)論 3 335
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望俊马。 院中可真熱鬧丁存,春花似錦、人聲如沸柴我。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,601評(píng)論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)屯换。三九已至编丘,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間彤悔,已是汗流浹背嘉抓。 一陣腳步聲響...
    開封第一講書人閱讀 33,702評(píng)論 1 274
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留晕窑,地道東北人抑片。 一個(gè)月前我還...
    沈念sama閱讀 49,191評(píng)論 3 378
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像杨赤,于是被迫代替她去往敵國(guó)和親敞斋。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,781評(píng)論 2 361