Setting up Subversion on Ubuntu Dapper Drake
Posted by Vince Wadhwani on May 03, 2006
Update: May 28, 2008:Check out the update for Hardy Heron
I recently decided to install Dapper Drake on a production machine which is not necessarily a smart thing considering it is in Beta. Still, having worked with Debian and Ubuntu for a long while, I was confident that it would be stable. But, just to be safe, I started off with the server version of Dapper. Getting Subversion working on Dapper is a piece of cake:
1: apt-get update && apt-get dist-upgrade
This will insure that your system is up to date before going any further. In general it's a good idea to run this command at least one per week to make sure you are up to date with the latest security patches.
2 apt-get install subversion
This, as you may expect, installs subversion. Hey, we're almost done!
3: create a directory in /home/svn/project1 using the command:
svnadmin create /home/svn/project1
4: put your code in a temporary directory, e.g. /tmp/repos.
You can set up subdirectories called trunk, branch, tag if you like. I am using Ruby on Rails so I didn't bother. I'm a newbie programmer though so feel free to tell me how stupid that is..
5:Import those repos by typing:
svn import /tmp/repos file:///home/svn/project1 -m "initial import"
6: apt-get install xinetd
This will install xinetd which is a new version of the internet superserver. Once you have installed it, make sure your /etc/xinetd.conf file looks like this to ensure that subversion starts on boot (note I also have a setting for ssh here so look in particular for the service svn part of my file for subversion specific info:
# Simple configuration file for xinetd
#
# Some defaults, and include /etc/xinetd.d/
defaults
{
}
service sshd
{
port = 22
server = /usr/sbin/sshd
}
service svn
{
port = 3690
socket_type = stream
protocol = tcp
wait = no
user = www-data
server = /usr/bin/svnserve
server_args = -i -r /home/svn
}
includedir /etc/xinetd.d
7: Take a look and edit /home/svn/project1/conf/svnserve.conf to uncomment general and the authorization stuff.
That should be it. To work with subversion, here are some basic commands that might be helpful:svn update (to update your local repository)
svn commit -m "your comment on your code" (to commit code with remarks for other people)
svn co svn+ssh://foo.com/home/svn/project1/ (to initially check out code)
svn add --force * (to add files to your local repository -- useful if you create a bunch of new files or add a bunch of images)