Create SVN Repository in Ubuntu & Access via HTTP


Assuming, you’ve Apache server installed already.

1. Install SVN

Open a terminal & type:

sudo apt-get install subversion

2. Create Repo

Let’s say, we want to create a repo in /var/svn/myrepo. Type in terminal:

cd /var
sudo mkdir svn
sudo svnadmin create /var/svn/myrepo

3. Users & Groups

Create a user & group named “svn”:

sudo adduser svn

Add user “www-data” to “svn” group:

sudo usermod -a -G svn www-data
sudo chown -R www-data:svn /var/svn/myrepo # Run this twice
sudo chmod -R g+rws /var/svn/myrepo # Run this twice

4.  Configure Apache2

Run in terminal:

sudo apt-get install libapache2-svn

You’ll find a file in /etc/apache2/sites-enabled folder. Let’s say, this file is “000-default” (in most cases) – edit this file by typing:

gksudo gedit /etc/apache2/sites-enabled/000-default

Add following lines in the beginning of the file:

    <Location /svn/myrepo>
      DAV svn
      SVNPath /var/svn/myrepo

      AuthType Basic
      AuthName "Subversion Repository"
      AuthUserFile /etc/apache2/passwords
      Require valid-user


Save the file, then restart apache:

sudo /etc/init.d/apache2 restart

5. Adding Users

Then Add the first user typing:

sudo htpasswd -cb /etc/apache2/passwords user1 password-for-user

# Add more users...

sudo htpasswd -b /etc/apache2/passwords user2 password-for-user

Finally, you’ll be able to access your repo at:


Instead of <ip-of-your-machine> you can also use your computer’s name.


One thought on “Create SVN Repository in Ubuntu & Access via HTTP

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s