Set up SVN server and configuration file in Centos

Source: Internet
Author: User
Tags svn client


Run Centos to build the SVN server and configuration file 1. install # yum install subversion to determine whether the installation is successful. When yum is installed, the above prompt is displayed: version svnserve, version 1.6.11 (r93411, the installation is successful. Www.2cto.com also needs to create a SVN database after SVN software is installed. # Mkdir/opt/svn/repos # svnadmin create/opt/svn/repos after executing the preceding command, multiple files are automatically created under repos, which are conf, db, format, hooks, locks, README.txt. 2. The configuration above is very simple, just a few commands, and the following operations are not difficult. Go to the conf folder generated above and configure the following files: authz, passwd, and svnserve. in conf, authz is the permission control, which users can access which directories, passwd is used to set users and passwords, and svnserve is used to set svn-related operations. 2.1 set passwd [users] # harry = harryssecret # sally = sallyssecrethello = 123 username = password so that we can establish a hello user, 123 password 2.2 and then set the permission authz www.2cto.com [/] hello = rw, which means that the hello user has read and write permissions on all directories. Of course, the permission can be limited. If you use it on your own, read and write it directly. 2.3 Finally set snvserv. conf www.2cto.com anon-access = none # Make unauthorized users unable to access auth-access = write # grant authorized users the write permission password-db = passwdauthz-db = authz # access control file realm =/opt/svn/repos # authenticate the namespace, the subversion is displayed in the authentication prompt and serves as the key word cached by the credential. Use the default configuration. All the above statements must be written in the top level, and no space is left. Otherwise, an error will occur. Now, through the above configuration, you can use svn. 3. connect to and start svn: svnserve-d-r/opt/svn/repos www.2cto.com. If svn is already running, run svnserve-d-r/opt/svn/repos -- listen-port 3391 on another port so that the same server can run multiple svnserver to change the configuration file and take effect immediately, you do not need to restart the service. Okay. After the startup is successful, you can use it. We recommend that you use TortoiseSVN with the connection address svn: // your server address (if the specified port needs to be added to the port: Port Number). After the connection, you can upload local files to effectively manage your code. Svnserve is a lightweight server provided by SVN. The client accesses the svnserve server by using a URL prefixed with svn: // or svn + ssh: // to remotely access the SVN version library. Www.2cto.com svnserve can set the user and password through the configuration file, and control the version library access permission by path. This article analyzes the svnserve configuration file format in detail and describes how to use the configuration file to control the access permission of the version library. This document introduces the SVN version 1.4.4. 1) svnserve configuration file Overview The svnserve configuration file is usually composed of the following three text files: svn service configuration file, under the conf directory of the file version library directory, the file name is svnserve. conf. User name and password file, which is specified in the file svnserve. conf. The default value is passwd in the same directory. Permission configuration file, which is also specified in the file svnserve. conf. The default value is authz in the same directory. 2) svn service configuration file is the file conf/svnserve. conf in the version library directory. This file consists of only one [general] configuration segment. The format of the configuration line in the [general] configuration section is as follows: <configuration item >=< value> www.2cto.com is divided into five configuration items: anon-access controls the permissions of non-authenticated users to access the version library. Optional values: "write", "read", and "none ". That is, "write" is readable and writable, "read" is read-only, and "none" indicates no access permission. Default Value: read auth-access controls the permission of the authenticated user to access the version library. Optional values: "write", "read", and "none ". That is, "write" is readable and writable, "read" is read-only, and "none" indicates no access permission. Default Value: write password-db specifies the name of the user name and password file. Unless an absolute path is specified, the file location is the relative path of the conf directory. Default Value: passwd www.2cto.com authz-db specifies the permission configuration file name. This file can be used to implement path-based access control. Unless an absolute path is specified, the file location is the relative path of the conf directory. Default Value: authz realm specifies the authentication domain name of the version library, that is, the authentication domain name prompted during logon. If the authentication domains of the two version libraries are the same, we recommend that you use the same user name and password data file. Default Value: a UUID (Universal Unique IDentifier, globally Unique IDentifier ). [Note] when you use the svn client to access the svnserve server, if you need to log on to the version library authentication domain, the following message is displayed: [root @ test root] # svn list svn: // 192.168.3.45/testAuthentication realm: <svn: // 192.168.3.45: 3690> 0d545a49-4038-0410-99b4-c66dc73f754ePassword for 'root ':
The character string displayed after "Authentication realm: <svn: // 192.168.3.45: 2nd>" is the name of the authenticated domain name. If you set the authentication domain in the configuration file, a UUID is displayed, as shown in the preceding figure. If the following configuration item is specified in the configuration file: www.2cto.com realm = test, the following prompt will be displayed on the svn client: [root @ test root] # svn list svn: // 192.168.3.45/testAuthentication realm: <svn: // 192.168.3.45: 3690> testPassword for 'root': Example 1: svn service configuration file conf/svnserve. the conf file is as follows: [general] anon-access = noneauth-access = writepassword-db = .. /.. /conf/passwdauthz-db = .. /.. /conf/authzrealm = test the configuration file above sets that the non-authenticated user has no permission to access the version database; the authenticated user can read and write the version database; the user name and password file is a file in the conf directory of the relative version library ".. /.. /con F/passwd "; the permission configuration file is the file in the conf directory of the relative version library".../../conf/authz "; the authentication domain of the version library is" test ". Www.2cto.com 3) the user name and password file is specified by password-db, the configuration item of svnserve. conf. The default value is passwd In the conf directory. This file consists of only one [users] configuration segment. [Users] the configuration line format of the configuration segment is as follows: <username >=< password> note: the password in the configuration line is plain text that has not been processed. Example 2: the user name and password file conf/passwd contains the following content: [users] admin = adminthinker = 123456 two users are configured in this file, with the user names "admin" and "thinker" respectively ". The password of the "admin" user is "admin"; "thinker" user is "123456 ". 4) The permission configuration file is specified by the configuration item authz-db of svnserve. conf. The default value is authz In the conf directory. The configuration file consists of a [groups] configuration segment and several version library path permission segments. The format of the configuration line in the configuration section www.2cto.com [groups] is as follows: <user group >=< User List> the user list consists of several user groups or user names. The user groups or user names are separated by commas ", "Separate, use the prefix" @ "When referencing a user group (for example, use the string" @ all "When referencing a user group" all "). The format of the segment name of the permission segment of the version library path is as follows: [<version library name>: <path>] For example, the CIDR Block of the version library abc path/tmp path is "[abc:/tmp]". The version library name in the segment name can be omitted. If the version library name is omitted, the version library path permission segment is effective for access control with the same path in all version libraries. For example, the path permission section of the version library named "[/tmp]" sets all access permissions for the directory "/tmp" in the version library that references the permission configuration file. The format of the configuration row in the permission section of the version library path is as follows: <user name >=< permission> <user group >=< permission> * = <permission> where, "*" indicates any user. The value range of permissions is '', 'R', and 'rw '.'' indicates that no permission is granted to the path of this version library, 'R' indicates read-only permission, and 'rw 'indicates read/write permission. Note: Only one user or user group can be configured for each row. Example 3 of www.2cto.com: Permission configuration file conf/authz: [groups] g_admin = admin, thinker [admintools:/] @ g_admin = rw * = [test: /home/thinker] thinker = rw * = r in the preceding configuration file, a user group "g_admin" is defined. This user group includes users "admin" and "thinker ". Then, two version library path permission segments are defined. Only the user group "g_admin" can read and write the version library "admintools". Other users do not have any permissions; path "/home/thinker" in the version library "test" only the user "thinker" has read and write permissions, and other users only have read and write permissions. Www.2cto.com 5) Summary in this article, details the three configuration files of the svnserve program. The SVN administrator can use these three configuration files to set the user name and password for the svnserve service and access permissions for the version library path. These configuration files take effect immediately after they are saved. You do not need to restart the svnserve service. Note that the configuration file described in this article is only valid for the svnserve service, that is, the client accesses the version library through a URL prefixed with svn: // or svn + ssh, the prefix http: //, https: //, or file: // is invalid.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.