Subversion ( svn) is a version management tool that has risen in recent years and is the successor to CVS. SVN server has 2 modes of operation: standalone server and Apache. There are pros and cons to each of the 2 ways.
file:///
|
Direct repository access (local disk). |
http://
|
By configuring the WebDAV Protocol of the Subversion Apache server. |
https://
|
http:// similar, but includes SSL encryption.
|
svn://
|
svnserve a protocol that is customized through the service.
|
svn+ssh://
|
svn:// similar to, but encapsulated via SSH
|
The
SVN store version data is also available in 2 ways: BDB and FSFS . Because the BDB mode is likely to lock the data when the server is interrupted, it is safer to fsfs the way.
1. SVN Server install operating system: Redhat Linux AS4
Get svn install package
Download http://subversion.tigris.org/ downloads/subversion-1.4.0.tar.gz and http://subversion.tigris.org/downloads/ Subversion-deps-1.4.0.tar.gz .
Compile svn to log in with the root user. The
uploads subversion-1.4.0.tar.gz and subversion-deps-1.4.0.tar.gz to the server.
Tar xfvz subversion-1.4.0.tar.gz
Tar xfvz subversion-deps-1.4.0.tar.gz
CD subversion-1.4.0
./configure –prefix=/opt/svn–without-berkeley-db–with-zlib
(Note: Run as svnserve without Apache compilation parameters.) Save the repository in FSFS format, do not compile berkeley-db)
make clean
made
make install
Vi/etc/profile,/etc/ Profile last added:
path= $PATH:/opt/svn/bin
Export PATH
SVN test svnserve–version
If shown below, SVN installation succeeded:
Svnserve, Version 1.4.0 (r21228)
Compiled OCT 2006, 10:18:56copyright (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 back-end (FS) modules is available:
* Fs_fs:module for working with a plain file (FSFS) repository.
2. SVN configuration build the SVN repository directory to build multiple:
Mkdir-p/OPT/SVNDATA/REPOS1
Mkdir-p/opt/svndata/repos2
Build SVN repository Svnadmin create/opt/svndata/repos1
Svnadmin Create/opt/svndata/repos2
To modify the SVN repository configuration file version 1:
Vi/opt/svndata/repos1/conf/svnserve.conf
Content modified to:
[General]
Anon-access = None
auth-access = Write
Password-db =/opt/svn/conf/pwd.conf
Authz-db =/opt/svn/conf/authz.conf
Realm = Repos1
Build Library 2:
Vi/opt/svndata/repos2/conf/svnserve.conf
Content modified to:
[General]
Anon-access = None
auth-access = Write
Password-db =/opt/svn/conf/pwd.conf
Authz-db =/opt/svn/conf/authz.conf
Realm = Repos2
That is, except for realm = Repos2, the other is identical to the version library 1 configuration file. If there are more repositories, and so on.
Configure SVN user vi/opt/svn/conf/pwd.conf to allow access
To simplify configuration, 2 repositories share 1 user profiles. If necessary, you can also separate.
Note: Changes to the user profile take effect immediately and do not need to restart SVN。
The file format is as follows:
[Users]
< user 1> = < password 1>
< user 2> = < password 2>
Among them, [users] is required. The following lists the users to access SVN, one row per user. Example:
[Users]
Alan = password
King = Hello
Configure SVN user access rights vi/opt/svn/conf/authz.conf
To simplify configuration, 3 repositories share 1 rights profile/opt/svn/conf/pwd.conf. If necessary, you can also separate. The user group and repository directory permissions are defined in the file.
Note:
* user names that appear in the permissions profile must already be defined in the user profile。
* Changes to the permissions profile take effect immediately and do not need to restart SVN。
User group format:
[Groups]
< user group name > = < user 1>,< user 2>
Of these, 1 user groups can contain 1 or more users, separated by commas between users.
Repository directory format:
[< Repository >:/project/catalog]
@< user Group Name > = < permissions >
< user name > = < permissions >
Where the box number can be written in several ways:
/, which indicates the root directory and the following. The root directory is specified at svnserve startup and we specify/opt/svndata. This means that the permissions are set for all repositories.
repos1:/, which indicates that permissions are set on version library 1
REPOS2:/ABC, which indicates that permissions are set on the ABC project in version Library 2
REPOS2:/ABC/AAA, which represents the AAA directory setting permissions on the ABC project in version 2
A permission principal can be a user group, user, or *, and the user group is preceded by @,* to represent all users. Permissions can be W, R, WR, and NULL, and NULL indicates no permissions.
Example:
[Groups]
admin = Alan
[/]
@admin = RW
[REPOS1:/ABC/AAA]
King = RW
[Repos2:/pass]
King =
SVN configuration complete, delete useless files Rm/opt/svndata/repos1/conf/authz
rm/opt/svndata/repos1/conf/passwd
Rm/opt/svndata/repos2/conf/authz
rm/opt/svndata/repos2/conf/passwd
3. Start SVN to build the user Useradd svn to start SVN
passwd SVN
Follow the prompts to set a password for the user svn
Allow user svn access to Repository Chown-r Svn:svn/opt/svndata
Chown-r Svn:svn/opt/data
Start Svnsu-svn-c "svnserve-d--listen-port 9999-r/opt/svndata"
which
SU-SVN means to start svn as user svn
-d means running in daemon (background run)
–listen-port 9999 means using 9999 ports, which you can replace with the ports you need. Note, however, that using a port under 1024 requires root access
-r/opt/svndata specifies that the root directory is/opt/svndata
Check:
Ps-ef|grep Svnserve
If shown below, this is the start success:
SVN 6941 1 0 15:07? 00:00:00 Svnserve-d–listen-port 9999-r/opt/svndata
There are many ways to access SVN from the web, seeConfigure WEBSVNOrConfigure BssvnbrowserThe method.
Related references:
http://www.ibm.com/developerworks/cn/opensource/os-subversion/
Linux under Installation configuration svn standalone server