Thorsten Wetzig
How to Setup Subversion on Ubuntu

For our software development we use Subversion – a powerful free tool for version control of files. Any file types are supported, even binary files. To be able to work with Subversion you have to setup a Subversion server. Then you can access the server from Subversion clients.

This blog entry shows one way to setup Subversion server on a Linux machine.

Everything you need to type in the same way as in the text is bold. Everything you can/should change is italic.

1. Install Subversion using a graphical package manager or with the following command:

$ sudo apt-get install subversion

Do not type the $ – this is just the prompt sign. For Ubuntu users:If your package manager can not find Subversion append the following line to the file /etc/apt/sources.list.
deb http://fr.archive.ubuntu.com/ubuntu hardy-backports main
You must be root to change the file.

2. Create a new user

Now create a new user on your Linux system. I recommend to call the user svn.

3. Create an empty repository

Login as svn. Type the following commands to create a new folder /home/svn/repositories.
$ cd /home/svn
$ mkdir repositories
$ cd repositories

Create a new repositoriy called myrepos:
$ svnadmin create myrepos

Nobody else than svn should be able to read/write the repository. So type:
$ chmod 700 myrepos

Start Subversion server as a daemon:
$ svnserve −−daemon −−root /home/svn/repositories

4. Subversion Server Configuration

Now we need to tell Subversion that it should use authorization to access it. I recommend the following settings.
$ cd /home/svn/repositories/myrepos/conf
$ nano svnserve.conf
Under [general] change the appropriate lines as followed:
Do not allow anonymous access at all.
anon-access = none
Authenticated write access is allowed.
auth-access = write
Uncomment the line below to use the default password file.
password-db = passwd

Now we have got an empty Suberversion repository. But in this state nobody can work with it. We need to allow at least one user to work with it.

5. Add a new user

Go to the conf folder with

$ cd /home/svn/repositories/myrepos/conf
$ nano passwd

Insert a new line with name and password of the new user like:
john = kdieu30975j

Take care that you use a different password and don’t use the example accidentally.

6. Check out the empty repository locally

Now the new user john can work with the repository. First he needs to check it out to his local machine. So do the following at the machine of the user; not at the server!

Go to the place you want to have the repository checked out. Let’s assume it is the following:

$ cd ~/code/

Let’s assume you want to have your repository in a folder called work. Check out the empty repository with:

$ svn checkout −−username john svn://www.server.com/myrepos work

Please don’t forget to use your server instead of the example. You can use an IP address as well.

7. First check in

Now you have got an empty repository. You can start to populate it with files. Just copy the files and folders you want to have into the new work folder. Go to your repository with:

$ cd /~/code/work

Assuming you added a folder www you can add it with:

$ svn add www

… and check it in with:

$ svn commit -m "initial files"

The option -m is followed by the check in comment. You should comment every check in.

Now you can continue to study the Subversion documentation. Or you can wait for the next blog entry about Subversion “How to use Subversion”.

Enjoy it, Thorsten

One thought on “How to Setup Subversion on Ubuntu

  1. Pingback: Need some help installing SVN through bash Drija

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by Sweet Captcha
Verify your real existence,
Drag the reel to the projector
  • captcha
  • captcha
  • captcha
  • captcha