Archive for Ubuntu

Apache, Subversion and post-commit hook

The following short tutorial will guide you through setting up mod dav with apache virtual hosts on ubuntu linux.  Assuming you have apache web server installed and running.

The first thing we need to do is  run the following commands in the terminal to install the required packages.


sudo apt-get install subversion libapache2-svn

with subversion installed we now need to create the directories for our subversion repository.


sudo mkdir /var/svn

sudo mkdir /var/svn/repository

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

sudo chmod 770 -R /var/svn/repository

next we are going to create a structure which will define how our directories are laid out.


cd ~

mkdir svn-temp

mkdir svn-temp/svn

mkdir svn-temp/svn/branches

mkdir svn-temp/svn/tags

mkdir svn-temp/svn/trunk

touch svn-temp/svn/trunk/index.html

now we are going to create our repository for our test site `test.example.com` and import our directory structure we just created.


sudo -u www-data svnadmin create /var/svn/repository/test.example.com

sudo -u www-data svn import ~/svn-temp file:///var/svn/repository/test.example.com -m"initial import"

Its time for the apache stuff now. We need to create a virtual host and create our web root directory.


sudo mkdir /var/www/test.example.com

sudo chown www-data:www-data /var/www/test.example.com

create the file ‘/etc/apache2/sites-available/test.example.com’ and add the following to it:

<VirtualHost *>
DocumentRoot /var/www/test.example.com/svn/trunk
ServerName test.example.com
ServerAlias www.test.example.com
<Location /svn>
DAV svn
SVNPath /var/svn/repository/test.example.com
</Location>
</VirtualHost>

enable the virtual host by typing the following command in the terminal


sudo a2ensite test.example.com

we’re getting there. we need to create our post-commit hook so that when we commit our repository the code will also be updated in the sites web directory also.

create the file ‘/var/svn/repository/test.example.com/hooks/post-commit’ and wirte the following two lines:

#!/bin/sh
/usr/bin/svn update /var/www/test.example.com/ –username www-data

then change the permissions and make it executable

sudo chmod +x /var/svn/repository/test.example.com/hooks/post-commit
sudo chown www-data:www-data /var/svn/repository/test.example.com/hooks/post-commit

we now need to be able to view the site in the browser. If you have a dns server already setup you can just configure that, if not you can add test.example.com to the ‘/etc/hosts’ file at the end of the line which starts with 127.0.0.1. so it should look like the following

127.0.0.1 localhost test.example.com

and restart the networking


sudo /etc/init.d/networking restart

Almost there. The last thing we need to do before we can load our website in the browser is the initial checkout and restart apache.

sudo -u www-data svn co file:///var/svn/repository/test.example.com /var/www/test.example.com
sudo /etc/init.d/apache2 restart

You can now fire up the browser and type test.example.com in the address bar and should see a blank page, that means everything went fine

Start working on your code by checking out a fresh copy.

cd ~
svn co http://test.example.com/svn testproj

thats all!

Comments (1)

right-click macbook + ubuntu

The touchpad on the macbook has only one mouse click button, but it is possible to map a keystroke to act as the mouse right-click.

To map the right command key as the mouse right-click add the following command to /etc/rc.local

xmodmap -e ‘keycode 116 = Pointer_Button3′

You then need to open ‘System->Preferences->Sessions’ and click ‘add’ in the ‘Startup Programs’ tab to execute the command when you login.  Fill in the Name field with whatever you want and then enter ‘/etc/rc.local’ in the command entry field and click ‘ok’.

Next time you login you can use the right command key as the mouse right-click.

Comments (1)

wireless on macbook + ubuntu

This is a quick guide which shows how to get your wireless card working with ubuntu hardy heron installed on a macbook that came with leopard pre-installed in 4 easy steps. It assumes that you already have ubuntu installed.

Step 1

First you need to identify the network controller that your macbook has. So run the ubuntu ‘hardware testing’ program which is located at ‘System->Administration->Hardware Testing’. Keep pressing next until you see the ‘Detecting your network controller(s)’ screen which will display the network controller detected.  Note down the name of your network controller as you will need this to install the correct driver. My macbook had the Broadcom controller, so for the remainder of this tutorial wherever i use ‘broadcom’ you will need to replace it with your own.

Step 2

Next you need to install the following packages using the synaptic packet manager (you will need the multiverse repository enabled):

rar

unrar

ndisgtk

ndiswrapper-common

ndiswrapper-utils-1.9

Step 3

Insert the leopard install disc 1 which came with your macbook and navigate to ‘boot camp->drivers->broadcom’. Create a new directory in your home folder and copy the ‘broadcomxpinstaller.exe’ file into it. Open a terminal and cd to the directory where you copied the exe file and run the following command:

unrar x broadcomxpinstaller.exe .

This will unpack the exe file and you should see a bunch of files, the one we are interested in is the .inf file. On my machine it was bcmwl5.inf

Step 4

Open ‘System->Administration->Windows Wireless Drivers’ and click on ‘Install New Driver’, locate the .inf file from the previous step and press ok.

The wireless driver installation is now complete all you need to do is configure your wireless network settings and you are all ready to start surfing the web.

Leave a Comment