SVN server construction process under Linux
1. Source file compilation and installation
There are two source files:
1. Download the subversion source file subversion-1.6.1.tar.gz
http://d136.d.iask.com/fs/800/1/187a3087a49b71b42ba4d4a300b6278746011506/gz/subversion-1.6.1.tar.gz
2. Download the subversion dependency file subversion-deps-1.6.1.tar.gz
Note: The two file versions must be the same , otherwise it is easy to cause problems .
2. Compile and configure subversion
2.1. Unzip the file
[root@DB2 tfhudong]# tar zxf subversion-1.6.1.tar.gz [root@DB2 tfhudong]# tar zxf subversion-deps-1.6.1.tar.gz
Note: Be sure to unzip the two files to the same directory, otherwise the problems mentioned below will occur.
2.2. Enter the decompressed subversion directory
[root@DB2 ~]# cd /usr/local/subversion-1.6.1/
2.3. Create the installation directory
[root@DB2 subversion-1.6.1]# mkdir /usr/local/svn
2.4. Compile and install subversion
2.4.1. Execution configuration
./configure --prifix=/usr/local/svn
##svn has two modes, one is FSFS as the default mode, the other is BDB mode, it is recommended to use FSFS .
If you get an error: configure: error: no suitable apr found
It is because the above dependent files are not decompressed to the same directory . . .
2.4.2. Compile and install
[root@DB2 subversion-1.6.1]# make
[root@DB2 subversion-1.6.1]# make install
2.4.3. Test whether the installation is successful
[root@DB2 subversion-1.6.1]# /usr/local/svn/bin/svnserve --version
svnserve , version 1.6.1 (r37116)
Compiled on Mar 4 2011 , 10:07:53
2.4.4. Commands can be added to environment variables
vi /etc/profile
Write the following two sentences
PATH=$PATH:/usr/local/svn/bin
export PATH
Execute the following statement to make the configuration take effect
source /etc/profile
3. Configure svn
3.1. Create a repository directory
(Please separate this from the installation directory, the following is the version library)
[root@DB2 subversion-1.6.1]# mkdir -p /data/svn/repos
3.2. Build SVN repository
[root@DB2 subversion-1.6.1]# svnadmin create /data/svn/repos/
After executing this command, svn automatically adds the necessary configuration files in the repos directory .
[root@DB2 subversion-1.6.1]# ls /data/svn/repos/
conf db format hooks locks README.txt
Note : The version library is different from the general folder . The newly created file directly on the operating system cannot be recognized by svn . You must use commands such as import to import the file into the version library . This is an internal command of svn , and create is used to create a new version library. Please use svn help for detailed instructions.
3.3. Modify the repository configuration file
[root@DB2 conf]# vi /data/svn/repos/conf/svnserve.conf
Each parameter function is described in the comments of the configuration file, and the configuration here is as follows :
[general]
anon-access = none #Make unauthorized users inaccessible
auth-access = write #Enable authorized users to have write access
password-db = passwd #Specify the password file path
authz-db=authz #Access control file
realm = /data/svn/repos #Authentication namespace, subversion will be displayed in the authentication prompt and used as a keyword for credential cache.
Others use the default configuration . Each statement must be written at the top, and no spaces can be left on the left , otherwise an error will occur .
Instruction introduction: This is the format of the svn configuration file, please write in the above format.
3.4. Configure users
[root@DB2 conf]# vi /data/svn/repos/conf/passwd
Insert the following
[users]
haifeng = 123456
game = 123456
More than one can be added, this is a username and password pair.
3.5. Configure permissions
[root@DB2 conf]# vi /data/svn/repos/conf/authz
insert the following
[/]
haifeng = rw
game = r
Lists authorizations for each user. Including read-only r , read-write rw . No user listed, access is not allowed. You can also group users, please refer to the svn manual for details
3.6. Start the svn service
[root@DB2 conf]# svnserve -d -r /data/svn/repos/
Command introduction: This command is used to start the svn service, -d indicates that it runs in daemon mode, and svn automatically listens on port 3690 . 3690 is the default port, you can use " --listen-port= " or " --listen-host= " to specify other ports. The -r option is used to specify the root directory of the svn service, so that users can use relative paths to access instead of providing full paths.
3.7. Check the port
[root@DB2 conf]# netstat -ntlp|grep 3690
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 15087/svnserve
At this point , the svn configuration is completed, and you can connect and use it on the client side.