Monday, September 7, 2009

Setup Subversion with Apache on Ubuntu

1. Install subversion and libapache2-svn:

sudo apt-get install subversion libapache2-svn

2. Add new group as subversion, and add www-data and subversion users to this group.

3. Logout and login again to become the member of subversion group.

4. Update/etc/apache2/mods-enabled/dav_svn.conf to something like this for the repository at /var/lib/svn/myporject:


DAV svn
SVNP ath /var/lib/svn

AuthType Basic
AuthName "myproject Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user


5. Create directory for repository and setup the ownership and permission:

sudo mkdir /var/lib/svn
cd /var/lib/svn
sudo mkdir myproject
sudo chown www-data:subversion myproject
sudo chmod -R g+rws myproject

6. Create the repository:

sudo svnadmin create /var/lib/svn/myproject

7. Restart Apache server:

sudo /etc/init.d/apache2 restart

8. Create user password:

sudo htpasswd -c /etc/subversion/passwd user

9. Test local svn server setup:

svn co http://localhost/svn/myproject --username username

Note: An empty myproject is checkout.

10. Create a project structure named mywork at the current directory then import the directory to the repository:

svn import -m "New import" mywork http://localhost/svn/myproject

To check the repository, and mywork should be shown up:

svn ls http://localhost/svn/myproject

11. To checkout myproject:

svn co http://localhost/svn/myproject/mywork mywork-new

No comments: