sudo fallocate -l 2G /swapfile 
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

sudo nano /etc/fstab
/path/to/swapfile none swap sw 0 0  //enable load swap on boot
#/path/to/swapfile none swap sw 0 0 //disable load swap on boot

sudo swapoff -v /swapfile //disable swap
sudo rm /swapfile //remove swap

swapon --show //information about all swap files in your system
free -h //information about memory in your system