hawshemi/linux-optimizer
关于
Linux 优化工具
系统与基础设施实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Linux Optimizer
This Bash script automates the optimization of your Linux server.
Notes:
- This script is designed for execution on Linux server environments, including VPS, VDS, Dedicated, and Bare Metal systems. It is not recommended for use on Linux desktop environments.
- Modifying the kernel (options 1 and 2) may result in removing or resetting some GPU drivers.
- Some VMs do not support kernel changes (options 1 and 2). Installing XanMod could cause the VM to break. Please be cautious and test beforehand.
It performs the following tasks:
Fix
hostsfile and DNS (temporarily):- Check and add 127.0.1.1 and server hostname to
/etc/hosts.
Original
hostsfile is backed up at/etc/hosts.bak.- Add
Cloudflare-SecurityDNS servers(1.1.1.2, 1.0.0.2)nameservers to/etc/resolv.conf.
Original
dnsfile 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
Disable Terminal Ads (Only on Ubuntu).
Install XanMod Kernel (Only on Ubuntu & Debian):
- Enable BBRv3.
- CloudFlare TCP Optimizations.
- More Details: https://xanmod.org
Install Useful Packages:
apt-transport-httpsapt-utilsautoconfautomakebash-completionbcbinutilsbinutils-commonbinutils-x86-64-linux-gnubuild-essentialbusyboxca-certificatescroncurldialogepel-releasegnupg2githavegedhtopjqkeyringlibssl-devlibsqlite3-devlibtoollocaleslsb-releasemakenanonet-toolspackagekitpreloadpython3python3-pipqrencodesocatscreensoftware-properties-commonufwunzipvimwgetzipEnable Packages at Server Boot.
Set the server TimeZone to the VPS IP address location.
Create & Enable
SWAPFile:- Swap Path:
"/swapfile" - Swap Size:
2Gb
- Swap Path:
Optimize the SYSCTL Configs:
- Optimize File System Settings.
- Optimize Network Core Settings.
- Optimize
SWAP. - Optimize
TCPandUDPSettings. - Optimize
UNIXDomain Sockets Settings. - Optimize
Virtual memory (VM)Settings. - Optimize Network Configuration Settings.
- Optimize the Kernel.
- Activate
BBR(BBRv3with XanMod).
Original file is backed up at
/etc/sysctl.conf.bak.Optimize SSH:
- Disable DNS lookups for connecting clients.
- Remove less efficient encryption ciphers.
- Enable and Configure TCP keep-alive messages.
- Allow 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 -xoptimizations.
- Soft and Hard ulimit
Optimize
UFWand open Common Ports:- Open Ports
SSH,80,443. - With
IPv6,TCP&UDP.
- Open Ports
Reboot at the end is recommended.
Prerequisites
Ensure that the sudo and wget packages are installed on your system:
- Ubuntu & Debian:
sudo apt update -q && sudo apt install -y sudo wget
- CentOS & Fedora:
sudo dnf up -y && sudo dnf install -y sudo wget
Run
Tested on: Ubuntu 20+, Debian 11+, CentOS Stream 8+, AlmaLinux 8+, Fedora 37+
Root Access is Required. If the user is not root, first run:
sudo -i
Then:
wget "https://raw.githubusercontent.com/hawshemi/Linux-Optimizer/main/linux-optimizer.sh" -O linux-optimizer.sh && chmod +x linux-optimizer.sh && bash linux-optimizer.sh
Menu Image
Debian & Ubuntu:
CentOS, AlmaLinux & Fedora:
Disclaimer
This script is provided as-is, without any warranty or guarantee. Use it at your own risk.
License
This script is licensed under the MIT License.
探索相关项目
加载中…