Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to install a Subversion server on my Ubuntu machine.
What packages to I need? How do I create a repository and set a new user?

share|improve this question
Depending on your needs, you might be better of with a distributed SCM like Bazaar (bzr), which is easy to learn coming from Subversion, but that does not need a server running. This is great if you are working alone and just need some log and safety net. And I just have to mention git, which is the most powerful tool out there, imho. – Martin Ueding Jul 4 '12 at 18:35
sudo apt-get install subversion – Amit Aug 21 '13 at 18:07
up vote 10 down vote accepted

There are many configurations for svn, here a some short instructions to get a basic svn repository available over http.

  1. Install required packages: apt-get install subversion apache2 libapache2-svn
  2. Create an Directory-Structure: mkdir -p /var/svn/repos/
  3. Create a Repository:
    • cd /var/svn/repos/
    • svnadmin create --fs-type fsfs <your-repository>
  4. Now Create your Project-Struckture to import in the repository:
    • mkdir -p /tmp/myproject/trunk /tmp/myproject/tags /tmp/myproject/branches
  5. Import the Project to the Repository:
    • svn import /tmp/myproject file:///var/svn/repos/<your-repository> -m "initial import"
  6. Make it accesseable over http:
    • cd /etc/apache2/sites-available
    • touch subversion.conf
    • vim subversion.conf

Now edit the empty file with this configuration:

NameVirtualHost *:80

<VirtualHost *:80>   
  <Location /svn>
      ErrorDocument 404 default
      DAV svn
      SVNParentPath /var/svn/repos
      SVNListParentPath off
      Require valid-user
      AuthType Basic
      AuthName "subversion access"
      AuthUserFile /var/svn/.htpasswd
      AuthzSVNAccessFile /var/svn/authz 
  • enable dav_svn module for apache: a2enmod dav_svn
  • enable authz_svn module for apache: a2enmod authz_svn
  • enable VHost configuration: a2ensite subversion.conf
  • now restart the webserver: /etc/init.d/apache2 restart
  • Create an htpasswd: htpasswd -c /var/svn/.htpasswd user
  • Create the access control file for the repository: touch /var/svn/authz
  • edit the empty authz file: vim /var/svn/authz
  • Give read/write rights to for user:


user = rw

Let's try to checkout the the repo over http: svn checkout http://your-server/svn/your-repository

share|improve this answer
I can't do the edit as the changes are too small, but could you fix the last line to say checkout as opposed to ceckout? – hexafraction Jul 5 '12 at 14:53
i can not find this package libapache2-svn. Error: #Reading state information... Done E: Unable to locate package libapache2-svn System: ubuntu 12.04 32bit (all repositories are enable) – shantanu Aug 26 '12 at 7:18
You also need to enable the authz_svn module, otherwise you will get Invalid command 'AuthzSVNAccessFile', perhaps misspelled or defined by a module not included in the server configuration. You can use the command a2enmod authz_svn to do this. – mrswadge Feb 22 '13 at 15:06

Start reading the manual. I am currently doing the same.

Once you have set up a repository with svnadmin create /path/to/repo, you can use svnserve --root /path/to/repo to make the repository available at svn://yourhost/. Open TCP port 3690 if necessary.

It's possible to use SVN over HTTP, but I have not read that part yet :o

share|improve this answer

You will need the subversion package.

sudo apt-get update
sudo apt-get install subversion

This package contains the client, tools to crate a Subversion repository and the server.

share|improve this answer


Subversion is an open source version control system.

you can follow this guide from :

version control system

share|improve this answer

Here is a blog post from WANdisco on how to install Tortoise SVN 1.7 and make your first repository change.

share|improve this answer
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Kris Harper Oct 25 '11 at 16:55

To install subversion, open a terminal and run the following command:

sudo apt-get install subversion libapache2-svn

We’re going to create the subversion repository in /svn, although you should choose a location that has a good amount of space.

sudo svnadmin create /svn

Change the owner of this repository to Apache user.

sudo chown -R www-data:www-data /svn

Create basic subversion repository for later use (for Production/QA/Testing/Stating../etc..)

sudo mkdir -p /tmp/myproject/trunk /tmp/myproject/tags /tmp/myproject/branches

Import those directory into our repository

sudo svn import /tmp/myproject file:///svn -m "initial import"

Next we’ll need to edit the configuration file for the subversion webdav module. You can use a different editor if you’d like.

sudo gedit /etc/apache2/mods-enabled/dav_svn.conf

The Location element in the configuration file dictates the root directory where subversion will be acessible from, for instance:

<Location /svn>

The DAV line needs to be uncommented to enable the dav module

# Uncomment this to enable the repository,
DAV svn

The SVNPath line should be set to the same place your created the repository with the svnadmin command.

# Set this to the path to your repository
SVNPath /svn

The next section will let you turn on authentication. This is just basic authentication, so don’t consider it extremely secure. The password file will be located where the AuthUserFile setting sets it to… probably best to leave it at the default.

# Uncomment the following 3 lines to enable Basic Authentication
AuthType Basic
AuthName “Subversion Repository”
AuthUserFile /etc/apache2/dav_svn.passwd

To create a user on the repository use, the following command:

sudo htpasswd -cm /etc/apache2/dav_svn.passwd <username>

Note that you should only use the -c option the FIRST time that you create a user. After that you will only want to use the -m option, which specifies MD5 encryption of the password, but doesn’t recreate the file.


sudo htpasswd -cm /etc/apache2/dav_svn.passwd geek
New password:
Re-type new password:
Adding password for user geek

Restart apache by running the following command:

sudo /etc/init.d/apache2 restart


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.