I found it could really handy to have my own SVN server, since I have been working on project from many different computers. Although I have been using CVS to manage projects on my own computer, when it comes to working on multiple computers and version control over the internet, SVN has its advantages. I pretty much prefer general WebDAV to more specific pserver approach. Besides, I prefer the default SVN behaviors, like the output of svn st
. I found a nice comparison just for fun.
SVN depends on several other software packages. It could be a pain in the ass if you try to install it on a system like Windows, which has completely no package management. Thanks to wonderful tools provided by Debian, it was so easy to get it done, although I had to google and check several installation guides. Oh yes, life of Mac users gets much easier by fink.
The first piece of software required is apache2. Now apache2 package on debian comes with ssl module built in, so there is no need to do a separate installation of that. So the first thing is get certificate. If you have a real one issued by a certificate agency, use it; otherwise, generate one for yourself by running apache2-ssl-certificate
. Answer the questions, and certificate will be generated under apache's configuration folder.
By default, the ssl module is not enabled. Simply run a2enmod ssl
to get it enabled. This commands will create links from modss-available
to mods-enabled
. I really appreciate the way how apache2 organizes its configuration folder. Now to enable a module or a virtual site, you don't have to make changes to a monolithic configuration file. This saves a lot of work and prevents many stupid errors.
A virtual site has to be configured to handle HTTPS requests. On debian, you can simply copy from a sample configuration from the document folder:
root@edsrv:~# cd /etc/apache2/sites-available/ root@edsrv:/etc/apache2/sites-available# cp /usr/share/doc/apache2/examples/ssl.conf.gz . root@edsrv:/etc/apache2/sites-available# gunzip ssl.conf.gz
You don't have to make much change to this file. I only changed the server name and the DocumnetRoot
. However, you have to change the default virtual site, because that one by default will bind to all ports. Change
NameVirtualHost *:* <virtualhost *:*>
into
NameVirtualHost *:80 <virtualhost *:80>
To enable this new virtual site, run a2ensite ssl.conf
if ssl.conf
is the filename of your configuration. This command will create a link from sites-available
to sites-enabled
.
After this, your apache should be able to handle HTTPS requests. You may try that now from you favorite browser.
The next thing is to get SVN part installed. This includes subversion
and libapache2-svn
. subversion
will install the client and repository management tools, and libapache2-svn
will install the modules required to expose your repository to the outside world using WebDAV.
Now create a testing repository:
root@edsrv:/opt/repositories# cd /opt root@edsrv:/opt# svnadmin create svn-repositories
Now the only thing remaining is to expose this folder via apache. Modify the virtual site you created for SSL by adding a virtual folder:
root@edsrv:/etc/apache2# cd mods-available/ root@edsrv:/etc/apache2# vi dav_svn.conf
Change the line SVNPath as well as the authentication part. You have to create a htpasswd2 password file as described in the comments. You may also consider using the PAM module for apache2.
# Uncomment this to enable the repository, DAV svn # Set this to the path to your repository SVNPath /opt/svn-repositories
# The following allows for basic http authentication. Basic authentication # should not be considered secure for any particularly rigorous definition of # secure. # to create a passwd file # # rm -f /etc/apache2/dav_svn.passwd # # htpasswd2 -c /etc/apache2/dav_svn.passwd dwhedon # New password: # Re-type new password: # Adding password for user dwhedon # # # Uncomment the following 3 lines to enable Basic Authentication AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/apache2/htpasswd Require valid-user
Now you can try checking out the empty project:
eddie@edsrv:~$ svn co https://localhost/svn Checked out revision 0.
Note that DreamHost offers Subversion if you don’t have your own Linux server.