-
Set the server TimeZone to Europe/Berlin.
-
Update, Upgrade, and Clean the server:
- Update
- Upgrade
- Dist-Upgrade
- AutoRemove
- AutoClean
- Clean
-
Install Useful Packages:
apt-transport-httpsapt-utilsautoconfautomakebash-completionbcbinutilsbinutils-commonbinutils-x86-64-linux-gnubuild-essentialbusyboxca-certificatescroncurldialogepel-releasegnupg2githavegedhtopiptablesiptables-persistentjqkeyringlibssl-devlibsqlite3-devlibtoollocaleslsb-releasemakenanonet-toolsnftablespackagekitpreloadpython3python3-pipqrencodesocatscreensoftware-properties-commonufwunzipvimwgetzip -
Enable Packages at Server Boot.
-
Create & Enable
SWAPFile:- Swap Path:
"/swapfile" - Swap Size:
2Gb
- Swap Path:
-
Enable
IPv6Support. -
Optimize the
SYSCTLConfigs.- Optimize
SWAP. - Optimize Network Settings.
- Activate
BBR. - Optimize the Kernel.
Original file is backed up at
/etc/sysctl.conf.bak. - Optimize
-
Optimize
SSH:- Back up the original
sshd_configfile. - Disable DNS lookups for connecting clients.
- Remove less efficient encryption ciphers.
- Enable and Configure TCP keep-alive messages.
- Allow agent & TCP forwarding.
- Enable gateway ports, Tunneling & Compression.
- Enable X11 Forwarding.
Original file is backed up at
/etc/ssh/sshd_config.bak. - Back up the original
-
Optimize the System Limits:
- ulimit
-c -d -f -i -n -q -u -v -x -s -loptimizations. - Soft & Hard
nproclimits. - Soft & Hard
nofilelimits.
- ulimit
-
Optimize
UFW& Open Common Ports.- Open Port
22. - With
IPv6,TCP&UDP.
- Open Port
Reboot at the end is Recommended.
- Ubuntu & Debian:
apt install -y sudo wget
- CentOS & Fedora:
dnf install -y sudo wget
sudo -i
wget "https://raw.githubusercontent.com/DanielNoohi/Linux-Optimizer/main/linux-optimizer.sh" -O linux-optimizer.sh && chmod +x linux-optimizer.sh && bash linux-optimizer.sh
This script is provided as-is, without any warranty or guarantee. Use it at your own risk.
This script is licensed under the MIT License.