sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon -s
then change fstab (/etc/fstab) so it automatically mounts your swap file on startup
/swapfile none swap sw 0 0
Afterward, check if your swap file is operating properly withtop or htop.
Leave any Questions and Comments below and I will get back to you. I regularly publish on YouTube, Steemit, and christitus.com so if you’d like to see more videos and articles click the subscribe button in the top right.