@FROM: http://blog.mypapit.net/2007/07/how-to-add-linux-swap-file-if-you-dont-have-swap-partition.html

$ sudo dd if=/dev/zero of=/dev/swap.img bs=1024k count=512
$ sudo mkswap /dev/swap.img
$ sudo swapon /dev/swap.img
$ sudo nano /etc/fstab
...
/dev/swap.img none  swap  sw  0 0        <-- add this line