Skip to content

Instantly share code, notes, and snippets.

@random-robbie
Created November 2, 2017 11:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save random-robbie/01a85161ac83244aff7f3747bbe79dfc to your computer and use it in GitHub Desktop.
Save random-robbie/01a85161ac83244aff7f3747bbe79dfc to your computer and use it in GitHub Desktop.
2GB Swap for a 512mb Ram VPS
#!/bin/bash
echo "[*] Swap Setup for VPS with 512mb... [*]"
swapon -s
dd if=/dev/zero of=/swapfile bs=1024 count=2048k
mkswap /swapfile
swapon /swapfile
echo 10 | sudo tee /proc/sys/vm/swappiness
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf
chown root:root /swapfile
chmod 0600 /swapfile
echo "[*] Swap Setup Complete... [*]"
@random-robbie
Copy link
Author

curl -L https://gist.github.com/random-robbie/01a85161ac83244aff7f3747bbe79dfc/raw//swap.sh | sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment