Created
October 8, 2018 08:12
-
-
Save intech/a28f2f3e051316513c3257597bff080f to your computer and use it in GitHub Desktop.
swap+kernel tuning
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
#!/bin/bash | |
apt update && apt upgrade -y && apt install -y mc htop curl git | |
# swap | |
fallocate -l 4G /swapfile | |
chmod 600 /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab | |
swapon --show | |
# kernel tuning | |
# sysctl | |
echo 'vm.swappiness=10' | tee -a /etc/sysctl.d/99-sysctl.conf | |
echo 'fs.file-max=500000' | tee -a /etc/sysctl.d/99-sysctl.conf | |
echo 'net.core.somaxconn = 65536' | tee -a /etc/sysctl.d/99-sysctl.conf | |
# security limits | |
echo '* hard nofile 32768' | tee -a /etc/security/limits.conf | |
echo '* soft nofile 32768' | tee -a /etc/security/limits.conf | |
echo 'root hard nofile 65536' | tee -a /etc/security/limits.conf | |
echo 'root soft nofile 65536' | tee -a /etc/security/limits.conf | |
sysctl -p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment