svn就這麼簡單1——安裝與配置 一,Subversion有兩種運行方式一種是基於Apache Http Server,另外一種是Subversion Standalone Server ,見linux svn安裝和配置,不結合apache。 以下是基於httpd的svn的安裝 二,安裝svn[plain] yum install -y httpd httpd-devel subversion mod_dav_svn 如果你已經裝了apache了,不想裝二個apache的話。你可以單獨下個subversion來裝一下就行了。 注意一點的是,路徑要正確: [plain] ./configure --with-apxs=/apache路徑/bin/apxs --prefix=/usr/local/subversion --with-apr=/usr/local/apache2 --with-apr-util=/apache路徑 --with-ssl --with-zlib --enable-maintainer-mode 1),確定已經安裝了svn模組:mod_dav_svn [plain] # cd /etc/httpd/modules/ # ls |grep svn mod_authz_svn.so mod_dav_svn.so 2),看一下svn是否已安裝成功 [plain] # svn --version svn, version 1.4.2 (r22196) compiled Aug 10 2009, 18:00:04 Copyright (C) 2000-2006 CollabNet. Subversion is open source software, see http://subversion.tigris.org/ This product includes software developed by CollabNet (http://www.Collab.Net/). The following repository access (RA) modules are available: * ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol. - handles 'http' scheme - handles 'https' scheme * ra_svn : Module for accessing a repository using the svn network protocol. - handles 'svn' scheme * ra_local : Module for accessing a repository on local disk. - handles 'file' scheme 三,建立倉庫,修改svn設定檔1),建立倉庫,以及倉庫目錄的設定 [plain] # mkdir -p /var/www/svn # cd /var/www/svn # svnadmin create test # chown -R apache.apache svn 2),編輯svn的設定檔 [plain] #vi /etc/httpd/conf.d/subversion.conf 如下: [plain] LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so <Location /svn> DAV svn SVNParentPath /var/www/svn # # # Limit write permission to list of valid users. # <LimitExcept GET PROPFIND OPTIONS REPORT> # # Require SSL connection for password protection. # # SSLRequireSSL # AuthType Basic AuthName "Subversion repository" AuthzSVNAccessFile /var/www/svn/authz.conf AuthUserFile /var/www/svn/user.passwd Require valid-user # </LimitExcept> </Location> 如果只有一個倉庫的話,那麼把參數SVNParentPath 換成 SVNPath,不過最好不要這樣啦,誰也不確定以後會用到幾個倉庫,而SVNParentPath可以包括多個倉庫,指定的路徑則是所有倉庫的父目錄。 3),添加使用者 下面建立可訪問使用者檔案 [plain] # htpasswd -bc /var/www/svn/user.passwd 使用者名稱 密碼 要增加使用者,則使用下面命令 [plain] # htpasswd -b /var/www/svn/user.passwd 使用者名稱 密碼 4),許可權分限 [plain] # vi /var/www/svn/authz.conf 內容如下:[plain] [test:/] //這表示,倉庫test的根目錄下的存取權限 jason = rw //test倉庫zhangy使用者具有讀和寫入權限 peterson = r //test倉庫hunk使用者具有讀許可權 [/] //這個表示在所有倉庫的根目錄下 * = r //這個表示對所有的使用者都具有讀許可權 #[groups] //這個表示群組設定 #svn1-developers = jason,peterson //這個表示某群組裡的成員 #svn2-developers = jason,kevin #[svn1:/] #@svn1-developers = rw //如果在前面加上@符號,則表示這是個群組使用權限設定 上面弄好了之後,重啟一下apache就行了[plain] #service httpd restart 然後訪問http://your_ip/svn/test輸入使用者名稱和密碼,就可以進入svn的test庫裡面了,現在進去是空的,裡面沒有什麼內容的,稍後提交新的內容就可以通過這個url看到了。