LinuxSVN server build

  

1. Ubuntu PC one, preferably the latest Ubuntu stable version

2. Run the following command to install subversion:

sudo apt-get updatesudo apt-get Install subversion

3. Assume that the root path of the code svn repository is /home/svnroot, execute the following command to create a new directory:

sudo mkdir /home/svnroot

4. Create a new code repository, assuming The repository name is: example

cd /home/svnrootsudo svnadmin create example After this command is executed, a directory named example will be added under /home/svnroot. This is the example code repository. 

5. Edit the access permissions of the example repository

That is: modify the three files under /home/svnroot/example/conf: authz passwd svnserve.conf

where: save in passwd Username and password authz saves the user group definition and the access rights definition of each directory. The configuration used by this code repository is saved in svnserve.conf (is an anonymous user allowed? Specify the username and password database...) Here is a typical Configuration:

passwd instance:


[users]xiaoming = 1111xiaowang = 2222xiaoli = 3333laowang = 4444shuangshuang = 5555dashi = 6666authz instance (admin can read and write all directories, dev Can read and write branch, dev read-only trunk/tag): 
[aliases]# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN =Joe Average[groups]admin = xiaolidev = laowang,shuangshuang,dashi,xiaowang,xiaoming[/]@admin = rw@dev = r[/trunk]@admin = rw@dev = r[/tag]@admin = rw @dev = r[/branch]@admin = rw@dev = rwsvnserve.conf instance (turn off anonymous access, specify user database and Database):
### This file controls the configuration of the svnserve daemon, if you### use it to allow access to this repository. (If you only allow### access through http: and/or file: URLs, then this file is### irrelevant.)### Visit http://subversion.tigris.org/for more information.[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 = noneauth-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. after 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 = My First Repository[sasl]### This option specified 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## #阅读 'Cyrus SASL authentication is available.'# use-sasl = true### These options specify the desired strength of the security layer### that you want SASL t o means. 0 means no encryption, 1 means### integrity-checking only, values ​​larger than 1 are correlated### to the effective key length for encryption (eg 128 means 128-bit### encryption). The values ​​below Are the defaults.# min-encryption = 0# max-encryption = 256

6. Add the svn service as a system self-starting project

- Create svnd.sh with the following contents

# !/bin/bashsvnserve -d -r /home/svnroot put this file in the /etc/init.d/svnd.sh script function: start the svn service, only after the service is started, the external machine can pass various The svn tool to access the svn server. 

- Add executable permissions

sudo chmod a+x /etc/init.d/svnd.sh- Edit rc.local
vim /etc/rc.local

in exit 0 Previously, add /etc/init.d/svnd.sh - restart the server and execute the command:

ps -e |
  Grep svnserve checks the svn service from the command results to automatically start with the system.
Copyright © Windows knowledge All Rights Reserved