Ref : https://askubuntu.com/questions/178712/how-to-increase-swap-space
# Adding Swap Space :
$ sudo su –
$ dd if=/dev/zero of=/root/swapfile bs=1024 count=6M
Note : If you want to make 3Gb file then change count value to count=3M.
$ mkswap /root/swapfile
$ vi /etc/fstab
# Add this line to /etc/fstab
/root/swapfile swap swap sw 0 0
$ swapon /root/swapfile