A concise tutorial on setting up an svn server under Windows
- 2020-05-13 04:05:28
- OfStack
svn (subversion) is a version management tool. Currently, most open source software USES svn as code versioning software. In addition to remembering all the changes to files and directories, svn can also restore files to a previous version, and can check the history to see what changes have been made to the data. It's a time machine.
Ann � svn program
Install svn
svn download address: http: / / subversion apache. org/packages html
For example, the svn installation directory is C:\Program Files\Subversion
When the installation is complete, add C:\Program Files\Subversion\bin system environment variable path, and the system may automatically add environment variable path.
Then, restart the machine.
Create local svn
Create svn library
Here is a sample svn library address D:\svn\repository (the folder must exist, otherwise the svn command will fail)
Use the command svnadmin create D:\svn\repository
When the command is complete, svn creates multiple folders in the D:\svn\repository directory, such as conf, dav, db, etc.
Add user
Go into the D:\svn\repository\conf folder and edit the svnserve.conf file. Remove the comment # before password-db = passwd (no blank in front) to indicate that the password was obtained from passwd.
Then edit the passwd file and add the user name below [users], as follows:
[users]
# harry = harryssecret
# sally = sallyssecret
test = 123456
Indicates that a user has been added with the username test and password 123456
Register svn to system services
cmd USES the following command:
sc create svnserve binpath= "C:\Program Files\Subversion\bin\svnserve.exe --service -r D:\svn\repository" depend= Tcpip start= auto
sc start svnserve
At this point, svn should be set up. Access address: svn://localhost
Configuration optimization for svn
Anonymous access
By default, svn is anonymously accessible and read-only. The changes are as follows:
Modify D:\svn\ conf\ svnserve.conf file and change anon-access = anon-access = none
Read and write access
The default svn is open to all directory permissions. The changes are as follows:
Modify D:\svn\repository\conf\ svnserve.conf file to remove the comment # before authz-db = authz (no white space in front) to indicate that authorization is obtained from authz.
Then edit the authz file as follows:
[/]
test = rw
test2 = rw
* =
[/secret]
test2 =
It indicates that all the directories of test can be read and written, while test2 can only read and write all the contents of the non-secret directory. Other users are not authorized.
svn port
The default port of svn is 3690. How to modify svn port is as follows:
sc create svnserve8888 binpath= "C:\Program Files\Subversion\bin\svnserve.exe --service -r D:\svn\repository --listen-port 8888" depend= Tcpip start= auto
sc start svnserve8888
Access address: svn://localhost:8888/
svn list
The svn list can be generated from Apache to access the svn content in a browser, as follows:
1. Copy mod_dav_svn.so and mod_authz_svn.so under C:\Program Subversion\bin into modules folder of apache
2. Modify apache configuration file httpd.conf:
1) remove the comment # in front of the following two items:
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_module modules/mod_dav.so
2) add the following:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn>
DAV svn
SVNPath D:/svn/repository
</Location>
After restart Apache Apache generates svn list, access address: http: / / localhost/svn