# Using the base Subversion server



## Hornpipe2 (Jun 27, 2016)

As of FreeBSD 10.0, a "light" version of Subversion has been integrated into the base system.  It includes most of the svn tools, though the filenames have been changed (e.g. "svnlite" instead of "svn", "svnliteserve" instead of "svnserve" etc.)  Most people probably would use this for the client, but it turns out the server binary is included as well... for most uses, you don't need the devel/subversion port any more.

Here is how you can do this yourself:

1. As root create the file /etc/rc.d/svnliteserve with these contents:

```
#!/bin/sh
#
# svnliteserve.sh for rc.d usage (c) 2016 Greg Kennedy.
# $Id$

# PROVIDE: svnliteserve
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable SVNServe:
#
#  svnliteserve_enable="YES"
#  # optional
#  svnliteserve_flags="-d --listen-port=3690 --listen-host 0.0.0.0"
#  svnliteserve_data="/usr/local/repositories"
#  svnliteserve_user="svn"
#  svnliteserve_group="svn"
#
# Note:
# svnliteserve bind per default at the ipv6 address!
# If you want svnliteserve binding at ipv4 address, you have
# to use option 'svnliteserve_flags' with --listen-host parameter

. /etc/rc.subr

# Set some defaults
svnliteserve_enable=${svnliteserve_enable:-"NO"}
svnliteserve_flags=${svnliteserve_flags:-"-d --listen-port=3690 --listen-host 0.0.0.0"}
svnliteserve_data=${svnliteserve_data:-"/home/svn/repos"}
svnliteserve_user=${svnliteserve_user:-"svn"}
svnliteserve_group=${svnliteserve_group:-"svn"}

name=svnliteserve
rcvar=svnliteserve_enable
load_rc_config $name
command=/usr/bin/svnliteserve
command_args="-r ${svnliteserve_data}"

run_rc_command "$1"
```

2. Ensure file is owned by root:wheel and chmod 555 (read-execute for all)

3. Edit /etc/rc.conf and add some lines:

```
# Enable built-in subversion server
svnliteserve_enable="YES"
# Flags to svnliteserve
#svnliteserve_flags="-d --listen-port=3690 --listen-host 0.0.0.0"
# Location of subversion repository on disk
#svnliteserve_data="/home/svn/repos"
# User to run svnserve as
#svnliteserve_user="svn"
# Group to run svnserve as
#svnliteserve_user="svn"
```

4.  Start it up!
`/etc/rc.d/svnliteserve start`

---

Notes:
* You may need to add the svn user and group, if you haven't already (the port may add them for you)
* Setting up a repository and other info is beyond the scope of this post... but should be just like the port.


----------



## Hornpipe2 (Feb 15, 2018)

Just adding that I opened a "bug report" (feature request) for this a while back.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210611

Not sure if it will make it into base but it did get a bit of traction.


----------

