1. Check the current partition status of the system:
>free -m
2. Create the file for the swap partition:
>dd if=/dev/zero of=/whatever/swap bs=block_size count=number_of_block
3. Set the swap partition file:
>mkswap /whatever/swap
4. Enable the swap partition file immediately:
>swapon /whateever/swap
5. If you want to enable it automatically at boot, you need to modify the swap line in the file /etc/fstab:
/whatever/swap swap swap defaults 0 0