Monthly Archives: October 2007

Ubuntu Server 7.04 Fiesty: How to Setup a Subversion Repository on Apache 2.0 using libapache2-svn

A few months ago I spent many hours pulling out my hair in a long attempt to get a Subversion repository accessible through Apache 2.0. The main benefit was the ability to browse through your repository using a web browser and the ability to integrate with the Trac Project Management tool.

The first step is to setup apache2, subversion, and libapache2-svn on your server. Login and type:

sudo apt-get install subversion apache2 libapache2-svn

Next restart the server. Type:

sudo /etc/init.d/apache2 restart

Since we will be using authenticating against specific users in the repository, we also need an SSL certificate for encryption. Type:

sudo a2enmod ssl
sudo apache2-ssl-certificate

 
After creating your SSL certificate, we need to enable port 443 on your server. To do this, edit your ‘/etc/apache2/ports.conf’ file and the line ‘Listen 443’. Your file should look like this:

Listen 80
Listen 443

Next you need to create a virtual host file for your server. If you would like more information on Apache 2.0 and virtual hosts, consult this article. Type:

sudo touch /etc/apache2/sites-available/svn.alexkuo.info

Now you will need to edit your new virtual host file and make it similar to the following.

NameVirtualHost *:443
<VirtualHost *:443>
ServerAdmin me@alexkuo.info
ServerName svn.alexkuo.info


<Location "/">
DAV svn
SVNPath /var/svn/akuo
AuthType Basic
AuthName "ALex Kuo's Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
<Limit GET PROPFIND OPTIONS REPORT>
Require valid-user
</Limit>
</Location>

CustomLog /var/log/apache2/svn.alexkuo.info.custom.log combined
ErrorLog /var/log/apache2/error.svn.alexkuo.info.log

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM
</VirtualHost>

In the first and lines, ‘NameVirtualHost *:443’ and ‘<VirtualHost *:443>’, tells the server to listen for all names on port 443, which is the SSL port that we specified previously. The ‘ServerName’ variable specifies the domain that this configuration applies to, in this case svn.alexkuo.info. The Location tags can be used to specify different references to repositories. In this example, their is only one – ‘http://svn.alexkuo.info/’.

In the location tag, ‘SVNPATH’ specifies the local path to the repository and the ‘AuthType’ variable specifies authentication type. The setting ‘Basic’ will just prompt for a username/password. The AuthUserFile is the authentication file that will be used to authenticate against when a user atttemps to access the repository. The settings in the <Limit> specify the permissions given to a valid-user.

Next, let’s setup a user for our repository. Type:

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

Now we should setup a repository at the location specified by the variable ‘SVNPath’ in our virtualhosts file. We also need to set the owner to ‘www-data’ and give that group read/write permissions to these directories. To do this type:

sudo svnadmin create /var/svn/akuo
sudo chown -R www-data:www-data /var/svn/akuo
sudo chmod -R g+ws /var/svn/akuo

The last thing we need to do is enable the site and restart Apache. Type:

sudo a2ensite svn.alexkuo.info
sudo /etc/init.d/apache2 restart

You should now be able to access your Subversion repository through the ‘http’ protocol.

Reference Links

Ubuntu Desktop 7.10: Setup HP 1200 Printer

After a short search through the Ubuntu forums, I ran into this post that went into details about setting up a HP printing device. After briefly reading through the instructions, I ran a utility called ‘HPLIP’. ‘HPLIP’ is a program that will automatically download and compile all the necessary files to activate your printer.  The program will ask you a few questions about your computer and request you replug-in your printer at the end of the installation. After doing this, I printed a test page and golly… it actually worked.

Ubuntu Linux: Syncing Documents between Different Computers Using NFS and Unison

The other day I successfully made a full transition from my laptop to my desktop as my primary development environment. The biggest hurdle before completing this transition was transferring and syncing documents between my two laptop and desktop. For quick file transfers, I created a network file share, or NFS, on my desktop, while mounting the drive on my laptop. For a quick overview on how to setup and mount NFS, consult this thread on Ubuntu forums.

I also wanted to sync and compare documents from a centralized server and have the ability to compare differences between a client and a centralized ‘master’ copy. (think Subversion – but without all the permissions and change logging) After a quick Google search, I found a wonderful program called ‘Unison’. This program will allow a user to define a master directory on a server and slave directory on a client. Master being the label for the directory where all clients compare their files and slave as clients that send new files or receive files copied from other clients to the master directory. For directions on installing unison, consult this article on howtoforge.com.