Home > FreeNAS > Subversion on FreeNAS

Subversion on FreeNAS

Like several other FreeNAS users I would like to run a Subversion server on my FreeNAS box. Sure, it is discouraged, but the alternative for me is to use an Internet-facing server or to keep a third machine running all the time. The FreeNAS box seems like the best choice.

The installation process is a bit involved as the embedded version of FreeNAS keeps the root file system in RAM. A standard installation will simply disappear after the first reboot.

Create a group and a user named svn through the web interface. Note that if you want to su to svn later on, a real shell is required, nologin will not work. Login to the Unix prompt and su to root. Create a directory on one of the mounted disks (not the root file system, which is a RAM disk!):

mkdir -p /mnt/data/apps/Subversion

Install the subversion package to the proper location:

setenv PKG_TMPDIR /mnt/data/apps/Subversion
pkg_add -r subversion -P /mnt/data/apps/Subversion

Include the dynamic libraries in the search path:

ldconfig -Rm /mnt/data/apps/Subversion/lib

Create a repository. Again the location must be on a mounted disk:

/mnt/data/apps/Subversion/bin/svnadmin create /mnt/data/apps/Subversion/svnrep

Configure the repository.

vi /mnt/data/apps/Subversion/svnrep/conf/svnserve.conf

Apart from comments this is an example:

anon-access = none
auth-access = write
password-db = passwd
realm = FreeNAS

Edit the password file (vi /mnt/data/apps/Subversion/svnrep/conf/passwd) and add users:

userid1 = password1
userid2 = password2

Create a start script for the Subversion daemon:

vi /mnt/data/apps/Subversion/bin/start_svnserve.sh

The start script needs to include the Subversion libraries before it launches svnserve:

ldconfig -Rm /mnt/data/apps/Subversion/lib
su svn -c '/mnt/data/apps/Subversion/bin/svnserve -d 
  --listen-host=n.n.n.n -r /mnt/data/apps/Subversion/svnrep'

The svnserve command should use a single line, wrapped for readability. Without the listen-host option Subversion may use an IPv6 address. Use the option with your IPv4 address to get around that. Make the script executable:

chmod +x /mnt/data/apps/Subversion/bin/start_svnserve.sh

Change ownership of all files properly:

cd /mnt/data/apps/Subversion
chown -R svn:svn svnrep

Test the script. If it works, add it as a PostInit start script (System/Advanced/Command scripts). Voila, FreeNAS is running Subversion!

Categories: FreeNAS
  1. Ben
    2011-08-19 at 22:12

    Hi Erik.
    Quick question: did you install the SVN on an embedded FreeNAS or a full version? I can’t find useful information anywhere only to find that SVN is only possible to install on a full FreeNAS. Your article doesn’t mention this surely but I have a feeling you did run it on an embedded version. A clarification would be appreciated

  2. 2011-08-20 at 09:13

    I used FreeNAS 0.7.1 (revision 5126) amd64-embedded, so yes the embedded version. It should work with the latest 0.7.2 release as well – I have upgraded and everything still works as it should. I haven’t tried FreeNAS 8 due to the significantly increased hardware requirements.

  3. 2011-09-30 at 11:13

    Why is this “discouraged”? I couldn’t find anything, neither official recommendations nor discouragement.

    Sure, they recommend against running svn off a network share – meaning the server on one machine, its files on another – due to the file locking semantics – but this doesn’t seem to be the case, you’re running svn on the FreeNAS machine, and it sees its discs directly, without a network layer.

    • 2011-09-30 at 18:11

      Well, I don’t have the links handy, but when I prepared for the installation I read several posts discouraging using FreeNAS as anything but a NAS. The point was that it might make the NAS less stable and that it would impact performance. Personally I don’t care, for a home or small office it is better to have a single machine that is always on. For a major corporation with money to spare I would use different servers. Still, my own setup has been rock stable since I replaced a broken network card some time ago. No downtime at all.

  4. 2011-11-14 at 01:10

    Interesting. With my 0.7.2 installation, the package installer cannot find SVN, and I haven’t found any way around that. The system is i386-embedded on AMD Athlon(tm) 64 Processor 3500+. Thwarted.

    • 2011-11-14 at 07:06

      I’m no FreeBSD expert, but you could try PACKAGESITE (point pkg_add to another repository for the installation) or portsnap. Good luck!

  5. Armin
    2011-11-18 at 19:49

    Hi Erik,
    thanks for your helpfull HowTo.
    All going well, but at the i can’t create a svn Projekt.
    I try it from an other host with
    svn list svn+ssh://svn@

    after that i get
    bash: svnserve: command not found.

    Or with a other question:
    How you checkin in SVN.

    • 2011-11-19 at 09:52

      Check the Subversion documentation at http://svnbook.red-bean.com, it covers everything. As for the svn command I don’t think you can use svn+ssh, at least not without additional configuration. Try regular svn (svn:// and see if that works. If not the online book should tell you what you need to do, though it might not work without additional packages in FreeNAS.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: