Create swap file linux

Allocate 2G swap file, set permissions, format and enable

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