1. Create swap file in size 2GB:
root# dd if=/dev/zero of=/swap bs=1M count=2048
2. Set permissions
root# chmod 600 /swap
3. Set the filesystem type as swap:
root# mkswap /swap
4. Activate the swap
root# swapon /swap
5. Add to /etc/fstab
/swap none swap defaults 0 0