Create swap file

dd if=/dev/zero of=/swap.img bs=2048 count=1M

Bake swap file

mkswap /swap.img

Add config to fstab

vim /etc/fstab
---
...
/swap.img swap swap sw 0 0
---

Change permission for swap.img

chmod 0600 /swap.img

Activate swap

swapon /swap.img

Disable swap

swapoff -a