Last active
May 26, 2017 02:40
-
-
Save BobRupholdt/0a2a43201c4f93d81e78 to your computer and use it in GitHub Desktop.
Adding swap file on DigitalOcean 512mb Ubuntu droplet so npm install will complete
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check for swapfile | |
sudo swapon -s | |
# if there is one | |
# swapoff -a | |
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024k | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
#swapfile should show now with | |
swapon -s | |
# set swappiness to keep the server happy | |
echo 10 | sudo tee /proc/sys/vm/swappiness | |
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf | |
# npm install should work fine now | |
# reboot your droplet so the changes aren't permanent | |
# any server with SSD drives doesn't like swap files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment