-
Fix
hosts
file and DNS (temporarily):- Check and add 127.0.1.1 and server hostname to
/etc/hosts
.
Original
hosts
file is backed up at/etc/hosts.bak
.- Add
77.88.8.8
and1.1.1.1
to/etc/resolv.conf
.
Original
dns
file is backed up at/etc/resolv.conf.bak
. - Check and add 127.0.1.1 and server hostname to
-
Update, Upgrade, and Clean the server:
- Update
- Upgrade
- Full-Upgrade
- AutoRemove
- AutoClean
- Clean
-
Install XanMod LTS Kernel (Only on Ubuntu & Debian):
- Enable BBRv3.
- CloudFlare TCP Optimizations.
- More Details: https://xanmod.org
-
Install Useful Packages:
apt-transport-https
apt-utils
autoconf
automake
bash-completion
bc
binutils
binutils-common
binutils-x86-64-linux-gnu
build-essential
busybox
ca-certificates
cron
curl
dialog
epel-release
gnupg2
git
haveged
htop
iptables
iptables-persistent
jq
keyring
libssl-dev
libsqlite3-dev
libtool
locales
lsb-release
make
nano
net-tools
nftables
packagekit
preload
python3
python3-pip
qrencode
socat
screen
software-properties-common
ufw
unzip
vim
wget
zip
-
Enable Packages at Server Boot.
-
Set the server TimeZone to the VPS IP address location.
-
Create & Enable
SWAP
File:- Swap Path:
"/swapfile"
- Swap Size:
2Gb
- Swap Path:
-
Enable
IPv6
Support. -
Optimize the SYSCTL Configs:
- Optimize
SWAP
. - Optimize Network Settings.
- Activate
BBR
(BBRv3
with XanMod). - Optimize the Kernel.
Original file is backed up at
/etc/sysctl.conf.bak
. - Optimize
-
Optimize SSH:
- 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 and compression.
- Enable X11 Forwarding.
Original file is backed up at
/etc/ssh/sshd_config.bak
. -
Optimize the System Limits:
- Soft and Hard ulimit
-c -d -f -i -l -n -q -s -u -v -x
optimizations.
- Soft and Hard ulimit
-
Optimize
UFW
and open Common Ports:- Open Ports
SSH
,80
,443
. - With
IPv6
,TCP
&UDP
.
- Open Ports
Reboot at the end is Recommended.
- Ubuntu & Debian:
apt update -q && apt install -y sudo wget jq
- CentOS & Fedora:
dnf up -y && dnf install -y sudo wget jq
sudo -i
wget "https://raw.githubusercontent.com/dpteam/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.