LongSpine.com Yes, we are lazy.

2Sep/094

Install Apache/Subversion on Debian Lenny and Migrate the Repositories

Install Subversion/Apache

sudo aptitude install subversion apache2 libapache2-svn

Subversion Configuration

Create subversion repositories:

sudo mkdir /var/svn
sudo chown -R www-data:www-data /var/svn

All our subversion repositories should be located in /var/svn in order to be visible to Apache (you can change /var/svn to something else).

SSL (Secure Sockets Layer)

The following steps are required if you need SSL, otherwise skip this chapter.

sudo aptitude install openssl ssl-cert
a2enmod ssl

"Listen 443" should already exist in /etc/apache2/ports.conf, otherwise add it manually:

sudo vi /etc/apache2/ports.conf

Create a new SSL config file (replace ssl.new.site with your preferred name):

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl.new.site

Edit the file:

sudo vi /etc/apache2/sites-available/ssl.new.site

Replace:

<VirtualHost *:80>

with

<VirtualHost *:443>

Before </VirtualHost>, add:

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/ssl.new.site.pem

You can try using the template from "default-ssl" instead of "default", which is easier and more reliable since many SSL-related configurations are already handled. However, I haven't tried this method and I'm not sure if it works without modifications.

Create SSL certificate file:

sudo mkdir /etc/apache2/ssl
sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/ssl.new.site.pem

Enable the new site:

sudo a2ensite ssl.new.site
sudo /etc/init.d/apache2 reload

To see if the setup works, use your web browser to visit:

https://server.ip/

Replace server.ip with the ip of your server. There should be a pop-up or an alert about the new certificate.

DAV_SVN Configuration

Edit /etc/apache2/mods-available/dav_svn.conf and follow the guidline:

sudo vi /etc/apache2/mods-available/dav_svn.conf

Normally it looks like this:

<Location /svn>
DAV svn
SVNParentPath /var/svn

AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd

Require valid-user
SSLRequireSSL      # this line must be added if you want SSL enabled

</Location>

Enable the mod and restart:

sudo a2enmod dav_svn
sudo /etc/init.d/apache2 restart

Create a user account for dav_svn:

sudo htpasswd -c /etc/apache2/dav_svn.passwd user1

To add more users, use:

sudo htpasswd /etc/apache2/dav_svn.passwd user2

Subversion Testing

sudo svnadmin create /var/svn/test
sudo chown -R www-data:www-data /var/svn/test

svn co https://new.site/svn/test

It should says "Checked out revision 0.", otherwise try looking for the errors on the Internet. You probably forgot some steps or I forgot to mention some details.

Migration

Skip this chapter if you don't need to migrate you data from your old server.

On the old server, we need to dump all updates into a single file. Each repository must be done separately.

mkdir svndump
cd svndump

sudo svnadmin dump /var/svn/repository > ./repository.dump

cd ..
tar zcvf svndump.tgz svndump
scp svndump.tgz username@new.server.ip:./

Those dump files must be applied on the new system's repositories.

tar zxvf svndump.tgz
cd /var/svn/repository

sudo svnadmin create repository-name
sudo svnadmin load repository-name < ~/svndump/repository.dump

sudo chown -R www-data:www-data /var/svn/*

Congratulations, all your source code has been migrated!

Comments (4) Trackbacks (0)
  1. Like this theme, nice one.

  2. Yes! Thank U so much. Super Tutorial. Works fine for me.

  3. You’re welcome. I’m glad that you like it :)

  4. Really usefull.

    Thank you.


Leave a comment


No trackbacks yet.

Recommended Reading

Recent Comments

Archives

Meta