Installing and setting up SVN on FreeBSD Server

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.
 
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):

Code:
#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
 
Where is svnadmin?

Code:
#cd /usr/ports/devel/subversion
#make install clean

# svnadmin create repository20110926
svnadmin: Command not found.
# uname -r 
9.0-BETA1
Sincerely,
Liu
 
Try [cmd=]rehash[/cmd] or [cmd=]hash -r[/cmd] (depending on shell).
 
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.

Code:
# cd /usr/ports/devel/subversion
# make install clean

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

Code:
# setenv SVN_ROOT /var/svn

Create a user svn.

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

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

Code:
# pw groupmod svn -m <i>user</i>


Create a general repository format.

Code:
# 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.
Code:
# chown -R svn:svn $SVN_ROOT
Add this to /etc/rc.conf

Code:
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:

Code:
# 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.
Code:
# 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.

Code:
[general]
password-db = userfile
realm = example realm

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

Code:
[users]
user1 = user1_password
user2 = user2_password

Change permissions on the configuration files.

Code:
chown -R root:wheel $SVN_ROOT/repos/example/conf
 
  • Thanks
Reactions: l2f
Back
Top