{"id":15070084,"url":"https://github.com/hawshemi/linux-optimizer","last_synced_at":"2025-05-15T13:07:10.774Z","repository":{"id":158917419,"uuid":"620965508","full_name":"hawshemi/linux-optimizer","owner":"hawshemi","description":"Linux Optimizer","archived":false,"fork":false,"pushed_at":"2025-03-08T17:37:28.000Z","size":419,"stargazers_count":641,"open_issues_count":1,"forks_count":98,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-05-15T13:07:05.178Z","etag":null,"topics":["almalinux","bbr","bbr3","bbrv3","centos","debian","dns","fedora","kernel","linux","optimizer","server","ubuntu","xanmod"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hawshemi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-03-29T18:12:10.000Z","updated_at":"2025-05-14T16:14:39.000Z","dependencies_parsed_at":"2023-11-30T13:28:39.980Z","dependency_job_id":"f19b5745-7d34-47da-9aa6-dbcc8ad2b958","html_url":"https://github.com/hawshemi/linux-optimizer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hawshemi%2Flinux-optimizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hawshemi%2Flinux-optimizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hawshemi%2Flinux-optimizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hawshemi%2Flinux-optimizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hawshemi","download_url":"https://codeload.github.com/hawshemi/linux-optimizer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254346624,"owners_count":22055808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["almalinux","bbr","bbr3","bbrv3","centos","debian","dns","fedora","kernel","linux","optimizer","server","ubuntu","xanmod"],"created_at":"2024-09-25T01:47:30.937Z","updated_at":"2025-05-15T13:07:05.765Z","avatar_url":"https://github.com/hawshemi.png","language":"Shell","readme":"# Linux Optimizer\n\n## This Bash script automates the optimization of your Linux server.\n#### Notes:\n 1. 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.\n 2. Modifying the kernel (options 1 and 2) may result in removing or resetting some GPU drivers.\n 3. 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.\n\n### It performs the following tasks:\n       \n0. Fix `hosts` file and DNS _(temporarily)_:\n    - Check and add 127.0.1.1 and server hostname to `/etc/hosts`.\n    \n    *Original `hosts` file is backed up at `/etc/hosts.bak`.*\n    - Add `Cloudflare-Security` DNS servers _`(1.1.1.2, 1.0.0.2)`_ nameservers to `/etc/resolv.conf`.\n    \n    *Original `dns` file is backed up at `/etc/resolv.conf.bak`.*\n\n\n1. Update, Upgrade, and Clean the server:\n    - _Update_\n    - _Upgrade_\n    - _Full-Upgrade_\n    - _AutoRemove_\n    - _AutoClean_\n    - _Clean_\n\n\n2. Disable Terminal Ads _(Only on Ubuntu)_.\n\n\n3. Install XanMod Kernel _(Only on Ubuntu \u0026 Debian)_:\n    - Enable BBRv3.\n    - CloudFlare TCP Optimizations.\n    - More Details: https://xanmod.org\n\n4. Install Useful Packages:\n\n    _`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`_ _`jq`_ _`keyring`_ _`libssl-dev`_ _`libsqlite3-dev`_ _`libtool`_ _`locales`_ _`lsb-release`_ _`make`_ _`nano`_ _`net-tools`_ _`packagekit`_ _`preload`_ _`python3`_ _`python3-pip`_ _`qrencode`_ _`socat`_ _`screen`_ _`software-properties-common`_ _`ufw`_ _`unzip`_ _`vim`_ _`wget`_ _`zip`_\n\n\n5. Enable Packages at Server Boot.\n\n    \n6. Set the server TimeZone to the VPS IP address location.\n\n \n7. Create \u0026 Enable `SWAP` File:\n    - Swap Path: `\"/swapfile\"`\n    - Swap Size: `2Gb`\n\n\n8. Optimize the [SYSCTL](https://github.com/hawshemi/Linux-Optimizer/blob/main/files/sysctl.conf) Configs:\n    - Optimize File System Settings.\n    - Optimize Network Core Settings.\n    - Optimize `SWAP`.\n    - Optimize `TCP` and `UDP` Settings.\n    - Optimize `UNIX` Domain Sockets Settings.\n    - Optimize `Virtual memory (VM)` Settings.\n    - Optimize Network Configuration Settings.\n    - Optimize the Kernel.\n    - Activate `BBR` _(`BBRv3` with XanMod)_.\n\n    *Original file is backed up at `/etc/sysctl.conf.bak`.*\n\n    \n9. Optimize [SSH](https://github.com/hawshemi/Linux-Optimizer/blob/main/files/sshd_config):\n    - Disable DNS lookups for connecting clients.\n    - Remove less efficient encryption ciphers.\n    - Enable and Configure TCP keep-alive messages.\n    - Allow TCP forwarding.\n    - Enable gateway ports, Tunneling and compression.\n    - Enable X11 Forwarding.\n\n    *Original file is backed up at `/etc/ssh/sshd_config.bak`.*\n   \n\n10. Optimize the [System Limits](https://github.com/hawshemi/Linux-Optimizer/blob/main/files/profile):\n    - Soft and Hard *ulimit* `-c -d -f -i -l -n -q -s -u -v -x` optimizations.\n    \n    \n11. Optimize `UFW` and open Common Ports:\n    - Open Ports `SSH`, `80`, `443`.\n    - With `IPv6`, `TCP` \u0026 `UDP`.\n\n    \n**Reboot at the end is recommended.**\n\n\n## Prerequisites\n\n### Ensure that the `sudo` and `wget` packages are installed on your system:\n\n- Ubuntu \u0026 Debian:\n```\nsudo apt update -q \u0026\u0026 sudo apt install -y sudo wget\n```\n- CentOS \u0026 Fedora:\n```\nsudo dnf up -y \u0026\u0026 sudo dnf install -y sudo wget\n```\n\n\n## Run\n#### **Tested on:** Ubuntu 20+, Debian 11+, CentOS Stream 8+, AlmaLinux 8+, Fedora 37+\n\n#### Root Access is Required. If the user is not root, first run:\n```\nsudo -i\n```\n#### Then:\n```\nwget \"https://raw.githubusercontent.com/hawshemi/Linux-Optimizer/main/linux-optimizer.sh\" -O linux-optimizer.sh \u0026\u0026 chmod +x linux-optimizer.sh \u0026\u0026 bash linux-optimizer.sh \n```\n\n\n## Menu Image\n### Debian \u0026 Ubuntu:\n![debian-based-menu](https://github.com/hawshemi/Linux-Optimizer/assets/16742123/3604470e-48ed-403d-a753-143dc934f6fd)\n\n### CentOS, AlmaLinux \u0026 Fedora:\n![rhel-based-menu](https://github.com/hawshemi/Linux-Optimizer/assets/16742123/07099e64-3864-425f-83e2-cda1e57d5b62)\n\n\n\n## Disclaimer\nThis script is provided as-is, without any warranty or guarantee. Use it at your own risk.\n\n\n## License\nThis script is licensed under the MIT License.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhawshemi%2Flinux-optimizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhawshemi%2Flinux-optimizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhawshemi%2Flinux-optimizer/lists"}