Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | Email

第 16 章 Invoking the Server

目錄

16.1. Installing
16.1.1. Ubuntu
16.1.2. CentOS 5
16.1.2.1. classic Unix-like xinetd daemon
16.1.2.2. WebDav
16.1.2.3. 項目目錄結構
16.1.3. CentOS 6
16.2. standalone “daemon” process
16.2.1. starting subversion for debian/ubuntu
16.2.2. starting subversion daemon script for CentOS/Radhat
16.3. classic Unix-like inetd daemon
16.4. hooks
16.4.1. post-commit
16.5. WebDav
16.5.1. davfs2 - mount a WebDAV resource as a regular file system

配置開發環境版本控制Subversion

Squid + Subversion 請參考Squid一節

16.1. Installing

16.1.1. Ubuntu

過程 16.1. subversion

  1. installation

    $ sudo apt-get install subversion
    $ sudo apt-get install subversion
    					
  2. create svn group and svnroot user

    $ sudo groupadd svn
    $ sudo adduser svnroot --ingroup svn
    					
  3. create repository

    $ svnadmin create /home/svnroot/test
    					
  4. testing

    svnroot@netkiller:~$ svnserve -d --foreground -r /home/svnroot/
    					

    check out

    neo@netkiller:/tmp$ svn list svn://localhost/test

    you may see some file and directory

    neo@netkiller:/tmp$ ls test/.svn/
    entries  format  prop-base  props  text-base  tmp
    					
  5. configure

    $ vim repositories/conf/svnserve.conf

    [general]
    anon-access = read
    auth-access = write
    password-db = passwd
    # authz-db = authz
    # realm = My First Repository
    					

    $ vim repositories/conf/passwd

    [users]
    # harry = harryssecret
    # sally = sallyssecret
    neo = chen
    					

    如果不允許匿名用戶checkout代碼,配置檔案這樣寫anon-access = none

    [general]
    anon-access = none
    auth-access = write
    					
  6. firewall

    $ sudo ufw allow svn
    					
16.1.2. CentOS 5
		
[root@development ~]# yum -y install subversion
		
		
16.1.2.1. classic Unix-like xinetd daemon
			
[root@development ~]# vim /etc/xinetd.d/subversion
service subversion
{
    disable = no
    port = 3690
    socket_type = stream
    protocol = tcp
    wait = no
    user = svnroot
    server = /usr/bin/svnserve
    server_args = -i -r /home/svnroot
}
			
			

firewall

			
iptables -A INPUT -p tcp -m tcp --sport 3690 -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 3690 -j ACCEPT
			
			
16.1.2.2. WebDav

install webdav module

			
[root@development ~]# yum install mod_dav_svn
			
			

create directory

			
mkdir /var/www/repository
svnadmin create /var/www/repository
			
			

subversion.conf

			
[root@development ~]# vim /etc/httpd/conf.d/subversion.conf
LoadModule dav_module modules/mod_dav.so
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
			
			

vhost.conf

			
<Location />
DAV svn
SVNPath /var/www/repository
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/subversion/svn-auth-file
Require valid-user
</Location>
			
			

auth file

			
[root@development ~]# htpasswd -c /etc/subversion/svn-auth-file my_user_name
			
			
16.1.2.3. 項目目錄結構

–trunk #存放主綫

–branches #存放分支,可修改

–tags #存放標記,不可修改

16.1.3. CentOS 6

CentOS 6 預設沒有安裝xinetd

# yum install xinetd
# yum install subversion

# mkdir -p /opt/svnroot
			

xinetd 配置

# vim /etc/xinetd.d/svn
service svn
{
    disable = no
    port = 3690
    socket_type = stream
    protocol = tcp
    wait = no
    user = svnroot
    server = /usr/bin/svnserve
    server_args = -i -r /opt/svnroot
}

# /etc/init.d/xinetd restart
Stopping xinetd:                                           [FAILED]
Starting xinetd:                                           [  OK  ]

# tail /var/log/messages | grep xinetd
May  5 18:57:20 SZVM42-C1-02 yum: Installed: 2:xinetd-2.3.14-16.el5.i386
May  5 18:59:22 SZVM42-C1-02 xinetd[4558]: Unknown user: svnroot [file=/etc/xinetd.d/svn] [line=8]
May  5 18:59:22 SZVM42-C1-02 xinetd[4558]: Error parsing attribute user - DISABLING SERVICE

[file=/etc/xinetd.d/svn] [line=8]
May  5 18:59:22 SZVM42-C1-02 xinetd[4558]: xinetd Version 2.3.14 started with libwrap loadavg labeled-networking

options compiled in.
May  5 18:59:22 SZVM42-C1-02 xinetd[4558]: Started working: 0 available services
			

service 名字必須與 /etc/services中定義的名字相同,否則將不能啟動,同時在/var/log/message中會提示如下

May  4 14:33:08 www xinetd[5656]: service/protocol combination not in /etc/services: subversion/tcp
May  4 14:33:08 www xinetd[5656]: xinetd Version 2.3.14 started with libwrap loadavg labeled-networking options compiled in.
May  4 14:33:08 www xinetd[5656]: Started working: 0 available services
May  4 14:33:33 www pulseaudio[21913]: sink-input.c: Failed to create sink input: too many inputs per sink.
May  4 14:33:33 www pulseaudio[21913]: sink-input.c: Failed to create sink input: too many inputs per sink.
May  4 14:33:33 www pulseaudio[21913]: sink-input.c: Failed to create sink input: too many inputs per sink.
May  4 14:33:33 www pulseaudio[21913]: sink-input.c: Failed to create sink input: too many inputs per sink.
May  4 14:33:33 www pulseaudio[21913]: sink-input.c: Failed to create sink input: too many inputs per sink.
May  4 14:33:33 www pulseaudio[21913]: sink-input.c: Failed to create sink input: too many inputs per sink.
May  4 14:33:33 www pulseaudio[21913]: sink-input.c: Failed to create sink input: too many inputs per sink.
May  4 14:33:33 www pulseaudio[21913]: sink-input.c: Failed to create sink input: too many inputs per sink.
May  4 14:33:41 www xinetd[5656]: Exiting...
May  4 14:33:41 www xinetd[5676]: xinetd Version 2.3.14 started with libwrap loadavg labeled-networking options compiled in.
May  4 14:33:41 www xinetd[5676]: Started working: 1 available service