Create a swap file

To Create a 2M swap file ( 1024 * 2048M = 2097152)

or this works as well bs = 1M count = 2048

dd if=/dev/zero of=/swapfile bs=1024 count=524288

mkswap /swapfile

swapon /swapfile

vi /etc/fstab

/swapfile swap swap defaults 0 0