歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> svn就這麼簡單1——安裝與配置

svn就這麼簡單1——安裝與配置

日期:2017/3/1 16:20:35   编辑:關於Linux
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看到了。
Copyright © Linux教程網 All Rights Reserved