Last active
January 2, 2016 16:29
-
-
Save johnyaucc/8330156 to your computer and use it in GitHub Desktop.
Revisions
-
johnyaucc renamed this gist
Jan 9, 2014 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,3 @@ # check for swap space swapon -s -
johnyaucc created this gist
Jan 9, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ # Reference: https://www.digitalocean.com/community/articles/how-to-add-swap-on-centos-6 # check for swap space swapon -s # check filesystem df -h # create and enabled the swap file (e.g. 512MB) sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k sudo mkswap /swapfile # activate the swap file sudo swapon /swapfile # add swap to filesystem vi /etc/fstab # by pasting the following /swapfile swap swap defaults 0 0 # set ownership and permission chown root:root /swapfile chmod 600 /swapfile # configure swappiness (0-100, 100 = swap often and too soon usually) sysctl vm.swappiness=10 cat /proc/sys/vm/swappiness # (optional) set swappiness on boot vi /etc/sysctl.conf # and set vm.swappiness=10 # note: It may be useful to set your swappiness to 0 to ensure that your VPS operates optimally.