Install Subversion Repository on Ubuntu Desktop

December 4th, 2009
Tags: , , , , , , , ,
Categories: General, Internet, Linux, Programming

This is a tutorial how to install a Subversion on your desktop. Subversion is an open-source revision control system. A repository is usually installed on servers so developers and programmers can have easy access to code. Subversion uses a check-in an check-out process for submitting changes to the repository. The repository can also be installed on desktop systems. Access is gained through many means by way of direct file access, ftp, http, svn and svn+ssh. See chart below.

Installing Subversion will install both Subversion administration tools and the client. In Ubuntu or Debian-based systems, you can install Subversion by performing the following commands. By the way, I added an Apache and Subversion WebDav module so both can be installed with just a single command.

Install Subversion

# sudo apt-get install subversion libapache2-svn

Reboot the Apache Web Server

# sudo /etc/init.d/apache2 restart

Create a Subversion Repository

# svnadmin create /home/yourname/repository/

I’m placing the repository in my home directory. You can place it anywhere in your system. You may need to use sudo if you install it outside of your home directory. Remember the repository location, we will use it a few times below to configure the Apache Subversion WebDav module, etc.

Import your Repository

# svn import /path/to/import/directory file:///home/yourname/repository

If you have a repository ready, now is a good time to import it. If you are just starting out, you can initialize the Repository here.

Access to Subversion

file:// Direct access on local disk
http:// Browser using http WebDav protocol
https:// Browser using https secure and WebDav
svn:// Subversion protocol
svn+ssh:// Subversion protocol and SSH tunnel

Configure WebDav protocol

# sudo vi /etc/apache2/apache2.conf

Add

<Location /svn>
DAV svn
SVNPath /home/yourname/repository
AuthType Basic
AuthName "Repository"
AuthUserFile /etc/subversion/passwd
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>

Change Ownership to HTTP-User

sudo chown -R www-data:www-data /home/yourname/repository

Password Protect the Repository

# sudo htpasswd -c /etc/subversion/passwd username

You will be asked to provide a password. Enter the password twice.

Reboot Apache Server

# sudo /etc/init.d/apache2 restart

It’s probably a good idea to restart the Apache server one more time.

Browser Access
Next, open up your browser and access http://localhost/svn from the address bar. You will be asked for the username and password. You should see the repository and any content or directory underneath it. That’s it. Happy coding.

  • Twitter
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • StumbleUpon
  • LinkedIn
  • Technorati
  • FriendFeed
  • Live
  • MySpace
  • Ping.fm
  • Posterous
  • Reddit
  • Slashdot
  • Suggest to Techmeme via Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz
  • Print
  • email
  • PDF
  • RSS

2 Responses to: Install Subversion Repository on Ubuntu Desktop

  1. [...] is usually installed on servers so developers and programmers can have easy access to code More here Subversion uses a check-in an check-out process for submitting changes to the repository. The [...]

Leave a Reply