First, connect to your server with the root access.
Then create the storage file :
dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
Give the permission to the file :
chown root:root /swapfile1
chmod 0600 /swapfile1
Setup a swap area :
Enable the swap file :
Edit the fstab :
Add the following line at the end of the fstab :
/swapfile1 none swap sw 0 0
Finally, check if it is working :
You should get values instead of the zero inside the swap line.