Setup the swap area on the file you created.
$ mkswap /swapfile0
Enable the file for swapping
$ swapon /swapfile0
Permanently enable the swap file on boot.
Add the following lines to /etc/fstab.
/swapfile0 swap swap defaults 0 0
Check that the swap file is working the the free command. Also,
reboot too to make sure the swap file works on restart and that
/etc/fstab was correctly configured.