Need a simple way to backup (and share) local files & scripts? Yeah yeah, another svn/websvn howto – but my brain sucks, and i forget this stuff if i don’t write it down…
The only prereqs to this quick howto are that you have an ubuntu box and you know a thing or two about subversion. Preferably a shellhost – I use slicehost and i’ve heard great things about linode.com.
I use svn for many of my projects, and for my toolkit. Tonight i needed to quickly and securely share a few files from that toolkit, so i stuck websvn on a host, and configured htaccess authentication. Total time? 10 min. Here’s the setup.
(Yes, i know the cool kids are all on git now)
- Create subversion repository in /var/svn
cd /var/svn svnadmin create repository
- install apache / websvn (apt-get install)
$apt-get install apache2 websvn
- Configure websvn – this is handled with the debian package, so when you’re done, your config (/etc/websvn/svn_deb_conf.inc) should look like this
<?php // please edit /etc/websvn/config.php // or use dpkg-reconfigure websvn $config->parentPath("/var/svn/"); $config->addRepository("repository", "file:///var/svn/repository"); $config->setEnscriptPath("/usr/bin"); $config->setSedPath("/bin"); $config->useEnscript(); ?>
- Create htpasswd file
$htpasswd -c -s /var/svn/htaccess testuser
- Configure htpasswd in apache config (/etc/websvn/apache.conf)
# Configuration for websvn using php4. Alias /websvn /usr/share/websvn <Directory /usr/share/websvn> DirectoryIndex index.php Options FollowSymLinks Order allow,deny Allow from all AuthType Basic AuthName "Subversion Repository" Require valid-user AuthUserFile /var/svn/htaccess <IfModule mod_php4.c> php_flag magic_quotes_gpc Off php_flag track_vars On </IfModule> </Directory>
- Restart Apache and you’re done.
$/etc/init.d/apache2 restart
thank you admin for informaion