Posted under » Version Control on 26 Feb 2019
You may have Apache isntalled already but you have to do it again
apt-get update apt-get install apache2 apache2-utils apt-get install subversion libapache2-mod-svn subversion-tools libsvn-dev a2enmod dav a2enmod dav_svn service apache2 restart
Config our svn
vim /etc/apache2/mods-enabled/dav_svn.conf
# ... # URL controls how the repository appears to the outside world. # In this example clients access the repository as http://hostname/svn/ # Note, a literal /svn should NOT exist in your document root. <Location /svn> # Uncomment this to enable the repository DAV svn # Set this to the path to your repository #SVNPath /var/lib/svn # Alternatively, use SVNParentPath if you have multiple repositories under # under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...). # You need either SVNPath and SVNParentPath, but not both. SVNParentPath /var/lib/svn # Access control is done at 3 levels: (1) Apache authentication, via # any of several methods. A "Basic Auth" section is commented out # below. (2) Apache and , also commented out # below. (3) mod_authz_svn is a svn-specific authorization module # which offers fine-grained read/write access control for paths # within a repository. (The first two layers are coarse-grained; you # can only enable/disable access to an entire repository.) Note that # mod_authz_svn is noticeably slower than the other two layers, so if # you don't need the fine-grained control, don't configure it. # Basic Authentication is repository-wide. It is not secure unless # you are using https. See the 'htpasswd' command to create and # manage the password file - and the documentation for the # 'auth_basic' and 'authn_file' modules, which you will need for this # (enable them with 'a2enmod'). AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/apache2/dav_svn.passwd # To enable authorization via mod_authz_svn (enable that module separately): # #AuthzSVNAccessFile /etc/apache2/dav_svn.authz # # The following three lines allow anonymous read, but make # committers authenticate themselves. It requires the 'authz_user' # module (enable it with 'a2enmod'). # Require valid-user # </Location>
Create a SVN Repository in the /var/lib/svn directory as stated in the config path.
mkdir /var/lib/svn svnadmin create /var/lib/svn/repository chown -R www-data:www-data /var/lib/svn chmod -R 775 /var/lib/svn
If you do not do the correct permissions as above, you will get this error
svn: Can't open file '/var/svn/foo/db/txn-current-lock': Permission denied
Now that your SVN repository is created, run the commands below to create an account name admin which is why we install apache2-utils. This is the same with squid authentication.
htpasswd -cm /etc/apache2/dav_svn.passwd admin
Type a password and continue to complete the setup. Repeat the step above to create additional users.
sudo htpasswd -m /etc/apache2/dav_svn.passwd user1 sudo htpasswd -m /etc/apache2/dav_svn.passwd user2
Restart Apache2. When you’re done, open your browser and browse to the reposotory, then logon.
http://example.com/svn/repository
To find out the version, svn --version
The config are located at ~/.subversion/servers