日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux下部署svn服务器

發布時間:2025/6/17 linux 79 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux下部署svn服务器 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

  系統Linux debian 2.6.32-5-686

  先安裝svn工具:apt-get install subversion,耐心等待安裝完成。安裝完成后svn客戶端、服務器都有了。

  接者建立svn倉庫目錄svnadmin create truck

root@debian:/home/xzc# svnadmin create truck root@debian:/home/xzc# cd truck root@debian:/home/xzc/truck# ls conf db format hooks locks README.txt root@debian:/home/xzc/truck# cd conf root@debian:/home/xzc/truck/conf# ls authz passwd svnserve.conf root@debian:/home/xzc/truck/conf#

可以看到,建立的目錄下已生成svn的配置文件。在默認配置下訪問svn是不需要權限的。下面來設置一下權限。
svnserve.conf主要是配置整個svn的權限,如果看得懂注釋,應該很容易明白。

### 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 = read 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 = truck[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 View Code

anon-access = read??? #anon表示未認證用戶(即在passwd文件里沒有該用戶),權限為可讀。可設置為none。如果anon-access = read而不是anon-access = none,則在使用merge功能時會出現客戶端試圖 svn merge 總是報svn: E220001: 遇到不可讀的路徑;拒絕訪問

auth-access = write? #已認證用戶(即在passwd文件里沒有該用戶),權限為可寫。注釋沒有rw這種寫法,估計是有寫權限必有讀權限

password-db = passwd #用戶配置文件,可以指定其他路徑名字。

authz-db = authz #用戶權限認證配置文件,可以指定其他路徑名字。

realm = truck? #認證范圍

認證范圍其實是自己定義的(一般為自己的svn目錄或項目名,只是為了好記)。比如我定義為truck,那么其他svn目錄如果在配置中也把認證范圍標為truck,那么就要用我的認證,即使用我的passwd、authz文件。舉個例子:

上面我們已在/home/xzc/truck下建立了一個svn倉庫,假如公司現在又開了一個項目,那么就要為新項目建立一個svn倉庫。而這個項目是由原項目truck的成員來做,又想用回原來的權限配置。svnadmin create truck_testanon-access = readauth-access = write password-db = ./../../truck/conf/passwdauthz-db = ./../../truck/conf/authz realm = truck #認證范圍

那么,因為兩個倉庫目錄的認證范圍相同,則共用一份認證文件。如果認證范圍一樣,但認證文件不相同,還不知道會發生什么事情。作者只說“If two repositories have the same authentication realm, they should have the same password database, and vice versa”。
下面配置用戶文件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 xzc = 1

可以看到,我增加了一個用戶xzc,密碼為1。注意一下空格之類的,以免認證錯誤。
然后是權限配置文件authz

### 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 local_administrator = xzc# [/foo/bar] # harry = rw # &joe = r # * =# [repository:/baz/fuz] # @harry_and_sally = rw # * = r[/] @local_administrator = r

?對第一個aliases不太清楚,猜測是別名。比如有個用戶名字叫aa_bb_cc_dd_ee,你嫌他名字太長太難寫,于是寫了個別名abcd = aa_bb_cc_dd_ee,那么下面配置權限只需要寫abcd就可以了。但原文件中的寫法實在看不懂,也懶得去驗證。不知有沒有大神知道。

groups就是組了,比如你想把管理人員分為一組、程序員分為一組,一組人的權限是相同的。組的名字自己隨意起。上面我起了一個local_administrator組,里面只有xzc一個用戶,如果有多個,用,號分開。

下面就是項目目錄的權限設置了。[倉庫名:/路徑],比如[truck:/]表示truck倉庫中根目錄的權限設置。這與svnserve的-r參數有關,在本例中svnserver -d -r /home/xzc/truck啟動則需要配置為[/],表示-r參數(/home/xzc/truck)的根目錄,svnserver -d -r /home/xzc/的參數則為[truck:/]。[/foo/bar]這種是絕對路徑的,不用倉庫名。

@local_administrator中的@表示local_administrator是一個組名而不是用戶名,所以注意起用戶名時不要帶這些符號。r表示只有read權限,也可以是rw或w或空,空表示什么權限都沒有。xzc = rw則表示用戶xzc具有read和write權限。* = r則表示所有用戶(防止用戶太多列不完)都有read權限。

注意:

1.authz文件修改后即生效,不用重啟svn。passwd也可以這樣,但在passwd中添加用戶后記得在authz中添加對應的權限。

2.如果遇到“Unable?to?connect?to?a?repository?at?URL xxx,認證錯誤”而且又不彈出讓你重新登錄的窗口時,則是沒有指定passwd用戶配置文件或是用戶配置文件里沒有任何用戶,又或者是passwd格式錯誤,見http://shuishiwo.iteye.com/blog/1754069。

3.authz中子目錄會繼承父目錄的權限,除非你另外設置了子目錄的權限。子目錄的權限優先于繼承的權限。見http://www.cnblogs.com/terryglp/articles/2451398.html。

  svn基本配置好了,那么就來啟動svn了(可試試svnserve -help幫助):svnserve -d -r /home/xzc/truck.

-d 表示以daemon方式(后臺運行)運行

-r 即指定倉庫目錄dir路徑

下面再來啟動另一個倉庫truck_test

xzc@debian:~$ svnserve -d -r /home/xzc/truck_test/ svnserve: 不能綁定服務器套接字: 地址已在使用

可以看到,因為svn默認端口已被truck使用,這個無法啟動,則需要指定端口

xzc@debian:~$ svnserve -d --listen-port 3691 -r /home/xzc/truck_test xzc@debian:~$ ps -ef | grep svnserve xzc 1702 1 0 20:40 ? 00:00:00 svnserve -d -r /home/xzc/truck xzc 1754 1 0 22:04 ? 00:00:00 svnserve -d --listen-port 3691 -r /home/xzc/truck_test xzc 1756 1442 0 22:04 pts/0 00:00:00 grep svnserve xzc@debian:~$

通過查看進程,可以看到兩個倉庫目錄都已啟動。接下來就是使用了。假如我的服務器ip為192.168.0.100,注意在check out時,是svn://192.168.0.100:3690而不是svn://192.168.0.100:3690/truck,倉庫的名字并不出現在路徑中,svn://192.168.0.100:3690其實就是/home/xzc/truck目錄。但如果以參數svnserve -d -r /home/xzc啟動,則是svn://192.168.0.100:3690/truck,不過這樣就把truck_test一起在同一端口啟動了。如果是路徑錯誤則報

如果在check out或commit的時候,發現權限問題,則考慮-r參數與authz的參數配置是否正確

?

轉載于:https://www.cnblogs.com/coding-my-life/p/3750589.html

總結

以上是生活随笔為你收集整理的linux下部署svn服务器的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。