Follow the following steps
sudo dd if=/dev/zero of=/swapfile count=2048 bs=1M
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
free -m
That’s all you need to do and you will have a swap file ready on your system. Change the count value to your suiting. 2048 means 2GB swap file. If you need more, change accordingly.
One Response