Skip to content

GetPHP-IR/Ubuntu-Optimizer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 

Repository files navigation

Ubuntu Optimizer

This Bash script automates the optimization of your Ubuntu server.

It performs the following tasks:

  1. Fix & Optimize System DNS Settings:

    Clean the /etc/resolv.conf and Add:

    • 1.1.1.1 - 1.0.0.1
  2. Update, Upgrade, and Clean the server:

    • Update
    • Upgrade
    • Dist-Upgrade
    • AutoRemove
    • AutoClean
    • Clean
  3. Install Useful Packages:

    software-properties-common build-essential apt-transport-https iptables iptables-persistent lsb-release ca-certificates ubuntu-keyring gnupg2 apt-utils cron bash-completion curl git zip unzip ufw wget preload locales nano vim python3 python3-pip jq qrencode socat busybox net-tools haveged htop libssl-dev libsqlite3-dev

  4. Enable Packages at Server Boot.

  5. Create & Enable SWAP File:

    • Swap Path: "/swapfile"
    • Swap Size: 2Gb
  6. Enable IPv6 Support.

  7. Clean the Old SYSCTL Configs.

  8. Optimize the SYSCTL Configs.

    • Optimize SWAP.
    • Optimize Network Settings.
    • Activate BBR.
    • Optimize the Kernel.
  9. Optimize SSH:

    • Back up the original sshd_config file.
    • 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.
  10. Optimize the System Limits:

    • Soft & Hard nproc limits.
    • Soft & Hard nofile limits.

Reboot at the end.

Prerequisites

  • Ubuntu server (16+) with root access.
  • curl

If your Ubuntu server does not have curl, install it first:

sudo apt install -y curl

Run

bash <(curl -s https://raw.githubusercontent.com/GetPHP-IR/Ubuntu-Optimizer/main/ubuntu-optimizer.sh)

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.

About

Ubuntu Optimizer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%