Setting up a local subversion repository server with nil security

There is much code for FreshPorts which lives in a subversion repository in my basement. I have long wanted to convert that to git and move it to git hub.

In this post:

  • FreeBSD 14.1
  • subversion 1.14.4

Which reminds me: I need to find a tool which backs up Github repos for me. Preferably everything under an organization. Just in case.

I will copy the data from my repo to another host and work on it there. This lessens the risk should I go wrong and unintentionally mess up my repo. If that happens, the original is intact. Therefore, I am not concerned with public access or security. If you can log onto this jail/host, you can get to the repo I’m setting up.

I’m following along from this FreeBSD forum post from 2011

Setting up

I’m creating a new svn user – pick your own name if you prefer.

[13:38 mydev dvl /usr/local] % id svn         
id: svn: no such user
[13:40 mydev dvl /usr/local] % sudo pw groupadd svn
[13:40 mydev dvl /usr/local] % sudo pw adduser svn -g svn -s /usr/sbin/nologin

I add myself to the group

[13:45 mydev dvl /usr/local] % sudo pw groupmod svn -m dvl

I create the directories (I’m basing it around /usr/local/svn, pick your own directory)

[13:46 mydev dvl /usr/local] % export SVN_ROOT=/usr/local/svn

I had already tar’d up this directory from the main server and copied the tarball over. Here, I unpack those files:

[13:56 mydev dvl /usr/local/svn/repos] % sudo tar -xzf ~/websites.tar.gz
[13:56 mydev dvl /usr/local/svn/repos] % 

Let’s fix up permissions:

[13:57 mydev dvl /usr/local/svn/repos] % sudo chown -R svn:svn $SVN_ROOT
[13:57 mydev dvl /usr/local/svn/repos] % ls -l
total 9
drwxr-x---  6 svn svn 8 2013.06.18 14:12 websites/
[13:58 mydev dvl /usr/local/svn/repos] % ls -l websites 
total 0
ls: websites: Permission denied
[13:58 mydev dvl /usr/local/svn/repos] % sudo ls -l websites
total 46
-rwxr-x---  1 svn svn 229 Jun 18  2013 README.txt
drwxr-x---  2 svn svn   5 Jun 18  2013 conf
drwxr-x---  6 svn svn  18 Dec 24 13:25 db
-rwxr-x---  1 svn svn   2 Jun 18  2013 format
drwxr-x---  2 svn svn  11 Jun 18  2013 hooks
drwxr-x---  2 svn svn   4 Jun 18  2013 locks
[13:58 mydev dvl /usr/local/svn/repos] % 

Network configuration

This may not be relevant to you. I’m running this in a jail and I want to assign a specific IP address to the jail.

In /etc/rc.conf, I added lo3 (lo1 and lo2 were already in use; ignore bridge0):

cloned_interfaces=”lo1 lo2 lo3 bridge0″

To create the new network device:

[14:01 r730-01 dvl ~] % sudo ifconfig lo3 create

To my jail configuration I added this:

    ip4.addr += "lo3|127.0.0.16";

After restarting the jail, I see:

lo3: flags=1008049 metric 0 mtu 16384
	options=680003
	inet 127.0.0.16 netmask 0xffffffff
	groups: lo

Back to subversion reconfiguration

I created /etc/rc.conf.d/svnserve with this content:

svnserve_enable="YES"
svnserve_flags="-d --listen-port=3690 --listen-host 127.0.0.16"
svnserve_data="/usr/local/svn/repos"
svnserve_user="svn"
svnserve_group="svn"

Those configuration items could have also gone into /etc/rc.conf – I’ve taken to putting application-specific configuration into separate files. The file name must match the rc.d script name. See man rc.conf,

Next, let’s start the service:

[14:08 mydev dvl /etc/rc.conf.d] % sudo service svnserve start
Stopping svnserve.
Starting svnserve.
[14:08 mydev dvl /etc/rc.conf.d] % ps auwwx | grep serve        
svn    98287  0.2  0.0 18804  5336  -  SsJ  14:08   0:00.00 /usr/local/bin/svnserve -d --listen-port=3690 --listen-host 127.0.0.16 -r /usr/local/svn/repos
dvl      703  0.0  0.0 12808  2388  0  S+J  14:09   0:00.00 grep serve
[14:09 mydev dvl /etc/rc.conf.d] % 
Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top