<code>yum </code><code>install</code> <code>subversion -y</code>
<code>[root@centos01 ~]</code><code># mkdir -p /application/svndata #資料存儲目錄</code>
<code>[root@centos01 ~]</code><code># mkdir -p /application/svnpasswd #使用者密碼 目錄</code>
<code>[root@centos01 ~]</code><code># svnserve -d -r /application/svndata/</code>
<code>[root@centos01 ~]</code><code># ps -ef |grep svn</code>
<code>root 6041 1 0 08:39 ? 00:00:00 svnserve -d -r </code><code>/application/svndata/</code>
<code>root 6043 5612 0 08:39 pts</code><code>/0</code> <code>00:00:00 </code><code>grep</code> <code>svn</code>
<code>[root@centos01 ~]</code><code># netstat -lntup |grep 3690</code>
<code>tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 6041</code><code>/svnserve</code>
<code>[root@centos01 ~]</code><code># </code>
<code>#########################################</code>
<code>#建立版本庫</code>
<code>[root@centos01 ~]</code><code># svnadmin create /application/svndata/daima</code>
<code>[root@centos01 ~]</code><code># tee /application/svndata/daima/</code>
<code>tee</code><code>: </code><code>/application/svndata/daima/</code><code>: Is a directory</code>
<code>^C</code>
<code>[root@centos01 ~]</code><code># tree /application/svndata/daima/</code>
<code>/application/svndata/daima/</code>
<code>├── conf</code>
<code>│ ├── authz</code>
<code>│ ├── </code><code>passwd</code>
<code>│ └── svnserve.conf</code>
<code>├── db</code>
<code>│ ├── current</code>
<code>│ ├── </code><code>format</code>
<code>│ ├── fsfs.conf</code>
<code>│ ├── fs-</code><code>type</code>
<code>│ ├── min-unpacked-rev</code>
<code>│ ├── rep-cache.db</code>
<code>│ ├── revprops</code>
<code>│ │ └── 0</code>
<code>│ │ └── 0</code>
<code>│ ├── revs</code>
<code>│ ├── transactions</code>
<code>│ ├── txn-current</code>
<code>│ ├── txn-current-lock</code>
<code>│ ├── txn-protorevs</code>
<code>│ ├── uuid</code>
<code>│ └── write-lock</code>
<code>├── </code><code>format</code>
<code>├── hooks</code>
<code>│ ├── post-commit.tmpl</code>
<code>│ ├── post-lock.tmpl</code>
<code>│ ├── post-revprop-change.tmpl</code>
<code>│ ├── post-unlock.tmpl</code>
<code>│ ├── pre-commit.tmpl</code>
<code>│ ├── pre-lock.tmpl</code>
<code>│ ├── pre-revprop-change.tmpl</code>
<code>│ ├── pre-unlock.tmpl</code>
<code>│ └── start-commit.tmpl</code>
<code>├── locks</code>
<code>│ ├── db.lock</code>
<code>│ └── db-logs.lock</code>
<code>└── README.txt</code>
<code>10 directories, 28 files</code>
<code>#修改配置檔案</code>
<code>[root@centos01 ~]</code><code># cd /application/svndata/daima/conf/</code>
<code>[root@centos01 conf]</code><code># ls</code>
<code>authz </code><code>passwd</code> <code>svnserve.conf</code>
<code>[root@centos01 conf]</code><code># cat svnserve.conf</code>
<code>### This file controls the configuration of the svnserve daemon, if you</code>
<code>### use it to allow access to this repository. (If you only allow</code>
<code>### access through http: and/or file: URLs, then this file is</code>
<code>### irrelevant.)</code>
<code>### Visit http://subversion.tigris.org/ for more information.</code>
<code>[general]</code>
<code>### These options control access to the repository for unauthenticated</code>
<code>### and authenticated users. Valid values are "write", "read",</code>
<code>### and "none". The sample settings below are the defaults.</code>
<code>anon-access = none</code>
<code>auth-access = write</code>
<code>### The password-db option controls the location of the password</code>
<code>### database file. Unless you specify a path starting with a /,</code>
<code>### the file's location is relative to the directory containing</code>
<code>### this configuration file.</code>
<code>### If SASL is enabled (see below), this file will NOT be used.</code>
<code>### Uncomment the line below to use the default password file.</code>
<code>password-db = </code><code>/application/svnpasswd/passwd</code>
<code>### The authz-db option controls the location of the authorization</code>
<code>### rules for path-based access control. Unless you specify a path</code>
<code>### starting with a /, the file's location is relative to the the</code>
<code>### directory containing this file. If you don't specify an</code>
<code>### authz-db, no path-based access control is done.</code>
<code>### Uncomment the line below to use the default authorization file.</code>
<code>authz-db = </code><code>/application/svnpasswd/authz</code>
<code>### This option specifies the authentication realm of the repository.</code>
<code>### If two repositories have the same authentication realm, they should</code>
<code>### have the same password database, and vice versa. The default realm</code>
<code>### is repository's uuid.</code>
<code># realm = My First Repository</code>
<code>[sasl]</code>
<code>### This option specifies whether you want to use the Cyrus SASL</code>
<code>### library for authentication. Default is false.</code>
<code>### This section will be ignored if svnserve is not built with Cyrus</code>
<code>### SASL support; to check, run 'svnserve --version' and look for a line</code>
<code>### reading 'Cyrus SASL authentication is available.'</code>
<code># use-sasl = true</code>
<code>### These options specify the desired strength of the security layer</code>
<code>### that you want SASL to provide. 0 means no encryption, 1 means</code>
<code>### integrity-checking only, values larger than 1 are correlated</code>
<code>### to the effective key length for encryption (e.g. 128 means 128-bit</code>
<code>### encryption). The values below are the defaults.</code>
<code># min-encryption = 0</code>
<code># max-encryption = 256</code>
<code>[root@centos01 conf]</code><code># diff svnserve.conf svnserve.conf.bak </code>
<code>12,13c12,13</code>
<code>< anon-access = none</code>
<code>< auth-access = write</code>
<code>---</code>
<code>> </code><code># anon-access = read</code>
<code>> </code><code># auth-access = write</code>
<code>20c20</code>
<code>< password-db = </code><code>/application/svnpasswd/passwd</code>
<code>> </code><code># password-db = passwd</code>
<code>27c27</code>
<code>< authz-db = </code><code>/application/svnpasswd/authz</code>
<code>> </code><code># authz-db = authz</code>
<code>#拷貝認證檔案模闆</code>
<code>[root@centos01 conf]</code><code># pwd</code>
<code>/application/svndata/daima/conf</code>
<code>authz </code><code>passwd</code> <code>svnserve.conf svnserve.conf.bak</code>
<code>[root@centos01 conf]</code><code># cp passwd authz /application/svnpasswd/</code>
<code>[root@centos01 conf]</code><code># </code>
<code>[root@centos01 conf]</code><code># cd /application/svnpasswd/</code>
<code>[root@centos01 svnpasswd]</code><code># ll</code>
<code>total 8</code>
<code>-rw-r--r--. 1 root root 1080 Dec 29 09:00 authz</code>
<code>-rw-r--r--. 1 root root 309 Dec 29 09:00 </code><code>passwd</code>
<code>[root@centos01 svnpasswd]</code><code># chmod 700 *</code>
<code>-rwx------. 1 root root 1080 Dec 29 09:00 authz</code>
<code>-rwx------. 1 root root 309 Dec 29 09:00 </code><code>passwd</code>
<code>[root@centos01 svnpasswd]</code><code># </code>
<code>#建立使用者并授權通路指定項目版本庫</code>
<code>[root@centos01 svnpasswd]</code><code># vim passwd </code>
<code>[root@centos01 svnpasswd]</code><code># cat passwd </code>
<code>### This file is an example password file for svnserve.</code>
<code>### Its format is similar to that of svnserve.conf. As shown in the</code>
<code>### example below it contains one section labelled [users].</code>
<code>### The name and password for each user follow, one account per line.</code>
<code>[</code><code>users</code><code>]</code>
<code># harry = harryssecret</code>
<code># sally = sallyssecret</code>
<code>admin = admin</code>
<code>yancong = yancong</code>
<code>[root@centos01 svnpasswd]</code><code># cat authz </code>
<code>### This file is an example authorization file for svnserve.</code>
<code>### Its format is identical to that of mod_authz_svn authorization</code>
<code>### files.</code>
<code>### As shown below each section defines authorizations for the path and</code>
<code>### (optional) repository specified by the section name.</code>
<code>### The authorizations follow. An authorization line can refer to:</code>
<code>### - a single user,</code>
<code>### - a group of users defined in a special [groups] section,</code>
<code>### - an alias defined in a special [aliases] section,</code>
<code>### - all authenticated users, using the '$authenticated' token,</code>
<code>### - only anonymous users, using the '$anonymous' token,</code>
<code>### - anyone, using the '*' wildcard.</code>
<code>###</code>
<code>### A match can be inverted by prefixing the rule with '~'. Rules can</code>
<code>### grant read ('r') access, read-write ('rw') access, or no access</code>
<code>### ('').</code>
<code>[aliases]</code>
<code># joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average</code>
<code>[</code><code>groups</code><code>]</code>
<code># harry_and_sally = harry,sally</code>
<code># harry_sally_and_joe = harry,sally,&joe</code>
<code># [/foo/bar]</code>
<code># harry = rw</code>
<code># &joe = r</code>
<code># * =</code>
<code># [repository:/baz/fuz]</code>
<code># @harry_and_sally = rw</code>
<code># * = r</code>
<code>[daima:/]</code>
<code>admin = rw</code>
<code>yancong = r</code>
<code>[root@centos01 svnpasswd]</code><code># ps -ef|grep svn</code>
<code>root 6095 5612 10 09:26 pts</code><code>/0</code> <code>00:00:00 </code><code>grep</code> <code>svn</code>
<code>[root@centos01 svnpasswd]</code><code># kill 6041</code>
<code>root 6097 5612 0 09:26 pts</code><code>/0</code> <code>00:00:00 </code><code>grep</code> <code>svn</code>
<code>[root@centos01 svnpasswd]</code><code># ls</code>
<code>authz </code><code>passwd</code>
<code>[root@centos01 svnpasswd]</code><code># svnserve -d -r /application/svndata/</code>
<code>root 6100 1 0 09:27 ? 00:00:00 svnserve -d -r </code><code>/application/svndata/</code>
<code>root 6102 5612 0 09:27 pts</code><code>/0</code> <code>00:00:00 </code><code>grep</code> <code>svn</code>
<code>[root@centos01 svnpasswd]</code><code>#</code>
本文轉自 yanconggod 51CTO部落格,原文連結:http://blog.51cto.com/yanconggod/1892239