FreeBSD. Svnserve — running Subversion without Apache!
Continuing the topic of moving away from Apache, today I’ll explain a simple way to run Subversion without Apache. We’ll use svnserver for this. Setup is fairly straightforward, so let’s get down to business!
After installing Subversion, you should have svnserve. You can check like this:
# svnserve --version
svnserve, version 1.6.4 (r38063)
compiled Aug 25 2009, 15:27:23
If you’ve just installed Subversion, don’t forget to run “rehash”.
Configuration
First, you now need to configure each repository separately, since each repository has its own svnserve.conf. Previously, though, I had shared configs for all my repos, and used permissions to sort out which groups had access to a particular repo and which didn’t. So I didn’t want to write the same thing for every repo, and decided to create a single svnserve.conf file and create a symbolic link to it in the other repos. That way, I’d only have to change settings in one place.
/var/svn/repos/ - the repository directory /var/svn/repos/adw0rd/ - one of the repositories /var/svn/repos/example/ - another repository /var/svn/repos/adw0rd/conf/svnserve.conf - the config for a specific repository
Move the configuration file:
mv /var/svn/repos/adw0rd/conf/svnserve.conf /var/svn/
Create the links:
ln -s /var/svn/svnserve.conf /var/svn/repos/adw0rd/conf/svnserve.conf
ln -s /var/svn/svnserve.conf /var/svn/repos/example/conf/svnserve.conf
And edit /var/svn/svnserve.conf:
[general]
# анонимам доступа нет
anon-access = none
# нужна авторизация для просмотра/записи
auth-access = write
# путь до файла с паролями
password-db = /var/svn/svn-passwd
# путь до файла группы/права
authz-db = /var/svn/svn-authz-access
# realm = My First Repository
Second, I had two files:
- A file with accounts (username/password), created using htpasswd
- A file with groups and permissions for the accounts
Now, though, only the second one (groups/permissions) can be used; it’s still valid.
The format of the first file has changed: permissions are now stored there in plain text, in the following format:
[users]
sally = sally_secret
adw0rd = adw0rd_password
Edit /var/svn/svn-passwd and add your accounts there.
Our permissions file is located at /var/svn/svn-authz-access and looks like this:
[groups]
dev1 = adw0rd, vasac
dev2 = sally
[/]
@dev1 = r
@dev2 = r
* =
[adw0rd:/]
@dev1 = rw
* =
[example:/]
@dev1 = rw
@dev2 = rw
* =
Starting Up
Edit /usr/local/etc/rc.d/svnserve and specify your own parameters if necessary. You can also change the user/group that svnserve will run as. If you don’t have this file, you can get it here.
Start the server:
/usr/local/etc/rc.d/svnserve start
And don’t forget to add this to /etc/rc.conf
svnserve_enable="YES"
Comments are closed. Read the original discussion in Russian →