Subversion download two files: subversion-1.6.17.tar.bz2and subversion-deps-1.6.17.tar.bz2, which are http://subversion.tigris.org/downloads/subversion-1.6.17.tar.bz2http://subversion.tigris.org/downloads/subversion-deps-1.6.17.tar.bz2Decompress subversion-1.6.17.tar.bz2and subversion-deps-1.6.17.tar.bz2 separately. After decompression, they are all in the subversion-1.6.17 folder and then execute configure. The command is as follows:
./configure --with-apxs=/opt/apache2/bin/apxs --with-apr=/usr/local/apache2 --with-apr-util=/usr/local/apache2 --prefix=/usr/local/subversion-1.6.7
The-with-apxs is used to generate the mod_dav_svn and mod_authz_svn modules of apache httpd. The-with-apr and-with-apr-util = parameters point to the installation root directory of Apache, instead of using the apr self-contained in the default SVN installation package, otherwise, if the Apache version you install is different, the APR library may not match, an error similar to Can't set position pointer in file '/svn/test/db/revs/1': Invalid argument occurs, and-prefix is the installation location. Some databases may not be found in the middle. Use yum as prompted. After configure is successful, compile and install it, that is
make && make install
If no error is reported, svn is successfully installed.
Suppose we create a version library under the/opt/svnroot directory, then run mkdir repository in the/opt/svnroot directory to create a version library folder, you can use the svnadmin create repository/test command to create a version library named test. If creation is successful, the installation of subversion is successful. Run the mkdir-p import/{trunk, branches, tags} command to create a new import folder in the/opt/svnroot Directory, which contains three subdirectories: trunk, branches, and tags. The following statement imports the directories and files in the path/opt/svnroot/import to the Subversion repository you created, and the submitted version is 1.
svn import /opt/svnroot/import file:///opt/svnroot/repository/test -m "Init repository"
Here/opt/svnroot/import can use relative paths, but file: // opt/svnroot/repository/test must be expressed in absolute paths.
Htpasswd-m-c/opt/svnroot/repository/pwdfile user1 (-c is used to generate the pwdfile file. If the file exists, the-c parameter is not required) htpasswd-m/opt/svnroot/repository/pwdfile user2htpasswd-m/opt/svnroot/repository/pwdfile user3
The authorization file is used to determine the operation permissions of each user on a specific directory. For the format, see conf/authz in the version Library (the authz file in the conf directory is used for authorization by svnserve, the format is the same as that of the mod_authz_svn authorization file ). Therefore, we can directly copy the authz under the conf file to the/opt/svnroot/repository directory we want and then modify it. The modified file is roughly as follows:
[groups]g_pm=user1g_dev=user2,user1[test:/]@g_pm=rw@g_dev=r[test:/trunk]@g_pm=rw@g_dev=r[test:/branches]@g_pm=rw@g_dev=rw[test:/tags]@g_pm=rw@g_dev=rw
G_pm and g_dev define two user groups. A user belongs to a user group and sets the corresponding permissions of the user group in each directory. r read-only and w can be modified, that is, you can modify the code of the svn version library.
Modify the directory owner and permissions
chown -R apache:apache /opt/svnrootchmod 700 /opt/svnrootchmod -R 700 /opt/svnroot/repository
Modify the httpd. conf file of apache and set both User and Group as apache. Add the following code at the end of the file:
<location /svn> DAV svn SVNParentPath /opt/svnroot/repository/ AuthType Basic AuthName "Subversion Repository" AuthUserFile /opt/svnroot/repository/pwdfile AuthzSVNAccessFile /opt/svnroot/repository/authz Satisfy Any Require valid-user</Location>
/Svn indicates a url pattern, which matches URLs in the form of http: // host/svn. All projects in the directory specified by SVNParentPath are considered as legal version libraries by subversion; authzSVNAccessFile is the authorization file; AuthType sets the client identity authentication mechanism. Basic indicates the Basic http authentication mechanism; AuthUserFile is the previously created password file; satisfy Any and Require valid-user tells all apache users to access the version library anonymously first. apache will authenticate the client only when the access control policy requires a real user name, this is the most used authorization method.