Enable swap on DigitalOcean instances

Enable swap on DigitalOcean instances

Just a quick summary of DigitalOcean article on enabling swap:

dd if=/dev/zero of=/swapfile bs=1024 count=4096k
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

And now add swapon /swapfile to your /etc/rc.local file.

echo "/swapfile   swap    swap    sw  0   0" >> /etc/fstab