# Installing and setting up SVN on FreeBSD Server



## richbt (Sep 8, 2009)

Hi,

I do apologise if this is in the wrong forum.

We are currently running FreeBSD on our server, I am currently looking for information on setting up a SVN repository on the server with the command prompt.

I have used terminal commands on Ubuntu in the past so I have some idea but I am nowhere near a expert. I have come across a handful of tutorials however they seem quite different and seem to skip a few bits. Im really looking for a step by step guide on setting up a repository and its users. Ideally a beginners guide so I know exactly whats happening.

I would really appreciate any hints or pointers in the right direction.

Thank you for your time.


----------



## tkuchheuser (Sep 8, 2009)

Hey richbt,

you might want to install the latest subversion release from the ports collection. If you did not install the collection on your server check the FreeBSD handbook [1] on that topic.
After that the installation of subversion is rather straightforward by
issuing the following commands (as root):


```
#cd /usr/ports/devel/subversion
#make install clean
```

The question is: How do you want to access the subversion repository(ies)? I prefer ssh. But this might not be the best way for a multiuser subversion system (and subversion is all about multiuser  ) Have a look at the subversion book [2]. The compiling process will offer you several additional access-options for subversion (like the apache2 mod_dav_svn).

If you have any further questions don't hesitate to ask.

    Timo

[1] http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports.html

[2] http://svnbook.red-bean.com/en/1.5/index.html


----------



## liuwang (Sep 27, 2011)

Where is svnadmin?


```
#cd /usr/ports/devel/subversion
#make install clean

# svnadmin create repository20110926
svnadmin: Command not found.
# uname -r 
9.0-BETA1
```
Sincerely,
Liu


----------



## DutchDaemon (Sep 27, 2011)

Try [cmd=]rehash[/cmd] or [cmd=]hash -r[/cmd] (depending on shell).


----------



## caesius (Sep 27, 2011)

*SVN Server Setup*

Here's what I use for setting up a personal SVN server.

Note the word _personal_; I don't care much about security.

EDIT: If anyone _does_ notice any mistakes I'd be happy to here them, I'll correct my guide and commit the changes to my repo (how meta).

-------------------------------------------------------------------------------

Subversion

*Installation and setup*

Install devel/subversion. The defaults are fine.


```
# cd /usr/ports/devel/subversion
# make install clean
```

Decide where the files will be stored. /var/svn is used here.


```
# setenv SVN_ROOT /var/svn
```

Create a user svn.


```
# pw groupadd svn
# pw adduser svn -g svn -s /usr/sbin/nologin
```

Add any users that will use the repositories to the svn group:


```
# pw groupmod svn -m <i>user</i>
```


Create a general repository format.


```
# mkdir -p $SVN_ROOT/repos
# mkdir -p $SVN_ROOT/defaults/trunk
# mkdir $SVN_ROOT/defaults/branches
# mkdir $SVN_ROOT/defaults/tags
```

User svn must own everything.

```
# chown -R svn:svn $SVN_ROOT
```
Add this to /etc/rc.conf


```
svnserve_enable="YES"
svnserve_flags="-d --listen-port=3690 --listen-host 127.0.0.1"
svnserve_data="/var/svn/repos"
svnserve_user="svn"
svnserve_group="svn"
```

*Creating a new project*

To create a new project called _example_:


```
# svnadmin create $SVN_ROOT/repos/<i>example</i>
# svn import $SVN_ROOT/defaults file://$SVN_ROOT/repos/example -m "Initial import"
```

Change the permissions on the newly created files.

```
# chown -R svn:svn $SVN_ROOT/repos/example
# chmod -R g+w $SVN_ROOT/repos/example
```

Set permissions. Edit $SVN_ROOT/repos/example/conf/svnserve.conf.


```
[general]
password-db = userfile
realm = example realm
```

Create a new file $SVN_ROOT/repos/example/conf/userfile.


```
[users]
user1 = user1_password
user2 = user2_password
```

Change permissions on the configuration files.


```
chown -R root:wheel $SVN_ROOT/repos/example/conf
```


----------



## liuwang (Sep 27, 2011)

*Thanks !*

DutchDaemon & Caesius,

Appreciate the support here.

"rehash" works !

Sincerely,
Liu


----------



## Carpetsmoker (Oct 4, 2011)

A bit late to the party (Don't read these forums that often :r), but I wrote a little guide on the subject some time ago:
http://arp242.net/weblog/Minimal_Apache_configuration_for_subversion.php


----------

