Slackware - SVN Howto
--dadexter 02:49, 14 Dec 2005 (GMT)
This how to will explain how to setup Subversion, a replacement for CVS. These instructions were written for use with an apache2 web server. Don't know if it will actually work with apache1. Thanks to my good old buddy cactus (e.cactuswax.net) for the original version of this, which I adapted to Slackware :)
1) Install Subversion
Download subversion and compile it using these steps:
- wget http://subversion.tigris.org/downloads/subversion-1.2.3.tar.bz2
- tar -jxvf subversion-1.2.3.tar.bz2
- cd subversion-1.2.3
- ./configure --prefix=/usr --with-apr=/usr/bin/apr-config --with-apr-util=/usr/bin/apu-config --with-zlib
If you're on Slackware 10.2 and above, subversion should already be installed. If not, grab it from your nearest friendly slackware mirror :)
2) As root, create the svn root:
- mkdir -p /home/svn/repositories
3) Configure apache-svn support
Add these 2 lines to your httpd.conf (mine is in /etc/apache2):
LoadModule dav_svn_module lib/apache/mod_dav_svn.so LoadModule authz_svn_module lib/apache/mod_authz_svn.so
I use SSL for apache, so I need to add
<Location /svn> DAV svn SVNParentPath /home/svn/repositories AuthzSVNAccessFile /home/svn/.svn-policy-file AuthName "Test SVN Repo" AuthType Basic AuthUserFile /home/svn/.svn-auth-file Satisfy Any Require valid-user </Location>
to my /etc/apache2/ssl.conf, inside the VirtualHost directive.
Don't forget to restart your httpd at this point
4) Setup the svn root directory:
[/] * = r [test:/] dadexter = rw
The * in the / section is matched to anonymous users. Any access above and beyond read only will be prompted for a user/pass by apache AuthType Basic. The /svn/test section inherits permissions from those above, so anon users have read only permission to it. I granted myself read/write permissions to the repo.
Create the svn-auth-file
This is either an htpasswd, or htdigest file. I used htpasswd. Again, because of SSL, I don't worry as much about password sniffing. htdigest would provide even more security vs sniffing, but at this point, I don't have a need for it.
htpasswd -cs /home/svn/.svn-auth-file dadexter
The above creates the file (-c) and uses sha1 for storing the password (-s). The user cactus is created. To add additional users, leave off the (-c) flag.
htpasswd -s /home/svn/.svn-auth-file userX
Create a repository
svnadmin create --fs-type fsfs /home/svn/repositories/test
I prefer the newer file-system based repository. No database corruption/blocking issues. (--fs-type fsfs)
The apache user needs permissions over the new repository.
chown -R nobody.nobody /home/svn/repositories/test
4) Client setup
Install the package created above (or the package from the Slackware mirror) on your development machine. Next, create a directory to hold your development stuff, and create the svn directory structure:
mkdir -p ~/coding cd ~/coding mkdir branches tags trunk
Put your source files into the created trunk directory. Here, I copy my development directory for an online reservation system I'm working on.
cp -R /home/martin/cal2/* trunk
Finally, import your development project into the svn repository:
svn import -m "Initial import" https://192.168.100.1/svn/test/
5) Testing the checkout
cd ~ rm -rf coding svn co https://192.168.100.1/svn/test/
I end up with the same ~/coding I had before :)