Centos/ubuntu配置SVN服务
生活随笔
收集整理的這篇文章主要介紹了
Centos/ubuntu配置SVN服务
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Centos安裝svn
yum -y install subversionubuntu安裝svn
apt-get install subversionCentos配置svn
root@hello:~# mkdir -p /svn/svn1 root@hello:~# svnadmin create /svn/svn1/ root@hello:~# cd /svn/svn1/conf/ root@hello:/svn/svn1/conf# ls authz passwd svnserve.conf root@hello:/svn/svn1/conf# vim passwd 編輯passwd,在【users】下添加用戶名和密碼### 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 Test = 123456root@hello:/svn/svn1/conf# vim authz [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_and_sally,組內有harry和sally用戶 # harry_sally_and_joe = harry,sally,&joe# [/foo/bar] 表示/foo/bar下的所有資源 # harry = rw harry 擁有讀寫權限 # &joe = r # * = 設置其他用戶具有的權限# [repository:/baz/fuz] 表示repository下的/baz/fuz下的所有資源 # @harry_and_sally = rw 設置harry_and_sally用戶組為讀寫權限 # * = r [svn1:/] 表示svn1下的所有資源 Test = rw 用戶Test 權限為讀寫root@hello:/svn/svn1/conf# vim svnserve.conf[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 #匿名訪問的權限,可以是read,write,none,默認為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 = SVN1 #認證空間名,SVN會在認證提示里顯示,并且作為憑證緩存的關鍵字[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 開啟sasl用戶驗證 ### 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 = 256ubuntu配置svn
root@hello:/svn/svn1/conf# pwd /svn/svn1/conf root@hello:/svn/svn1/conf# ls authz hooks-env.tmpl passwd svnserve.confroot@hello:/svn/svn1/conf# vim passwd[users] Test = 123456root@hello:/svn/svn1/conf# vim authz[aliases] # joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average[groups][svn1:/] Test = rwroot@hello:/svn/svn1/conf# vim svnserve.conf [general] anon-access = none auth-access = write password-db = passwd authz-db = authz # groups-db = groups 指定“group file”的位置,而該目錄下并沒有groups文件,因此該配置不能被啟用! realm = svn1 # force-username-case = none # hooks-env = hooks-env[sasl] # use-sasl = true # min-encryption = 0 # max-encryption = 256開機自動啟動SVN腳本:
#!/bin/bash PatH=`/svn/svn1` SvN=`which svnserve` $SvN -d -r $PatH添加開機啟動
echo "bash /腳本絕對路徑/腳本名" >> /etc/rc.d/rc.localSVN啟動控制腳本
根據實際情況進行修改 路徑等信息
#!/bin/bash #chkconfig: 345 95 95 #description: svn stop(){ kill $(ps -ef | grep "svnserve -d -r" | grep -v grep | awk '{print $2}') > /dev/null 2>&1 if [ ! $? -eq 0 ] thenecho "stop ERROR..." fi } start(){ svnserve -d -r /svn/ > /dev/null 2>&1 if [ ! $? -eq 0 ] thenecho "start ERROR..." fi } restart(){ stop start } case $1 in stop)stop ;; start)start ;; restart)restart ;; *)echo "please INPUT stop|start|restart"exit 110 ;; esac添加到系統服務(僅針對centos6.x系統)
將上面腳本命名為svnd
chmod +x ./svnd mv ./svnd /etc/init.d/ chkconfig svnd --add chkconfig svnd on chkconfig svnd --list
?
轉載于:https://www.cnblogs.com/LuckWJL/p/9928145.html
總結
以上是生活随笔為你收集整理的Centos/ubuntu配置SVN服务的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2023上半年小家电承压前行 新品类、新
- 下一篇: 星纪魅族沈子瑜:极星手机类似华为保时捷