Skip to content

Instantly share code, notes, and snippets.

@cybersholt
Created February 23, 2018 13:02
Show Gist options
  • Save cybersholt/23b0f61ea0580a688c29a707bf75145a to your computer and use it in GitHub Desktop.
Save cybersholt/23b0f61ea0580a688c29a707bf75145a to your computer and use it in GitHub Desktop.
Swap for CentOS 7
# Creates SWAP on the server
# One of the things that I have lerned is that this kind of servers need swap.
# With these fast SSD disks you gain kind of "pseudo-ram"!!!.
sudo dd if=/dev/zero of=/swapfile bs=1G count=1
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo echo "/swapfile none swap sw 0 0" >> /etc/fstab
sudo sysctl vm.swappiness=10
sudo echo "vm.swappiness=10" >> /etc/sysctl.conf
sudo sysctl vm.vfs_cache_pressure=50
sudo echo "vm.vfs_cache_pressure=50" >> /etc/sysctl.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment