All-in-One Linux Init Scripts for Rocky, AlmaLinux, CentOS, Ubuntu, Debian & More
This article introduces a comprehensive collection of shell scripts that automate system initialization across many Linux distributions—Rocky, AlmaLinux, CentOS, Ubuntu, Debian, openEuler, AnolisOS, OpenCloudOS, openSUSE, Kylin Server and UOS Server—covering network setup, hostname, repository configuration, firewall, SELinux, swap, timezone, kernel tuning, SSH, user environment and more, with detailed version changelogs and usage instructions.
Supported Functions and Systems
Supported Functions: modify network interface names, configure network (IP address, netmask, gateway, DNS) for single or dual NICs, set hostname, configure mirror repositories, install minimal recommended packages, disable firewall, disable SELinux, disable swap, set system timezone, optimize resource limits, tune kernel parameters, optimize SSH, change SSH port, set system alias, configure vimrc, install and configure mail service, set PS1, set default editor to vim, configure history format, disable Ctrl+Alt+Del reboot, enable root login on Ubuntu/Debian, uninstall unnecessary packages on Ubuntu, uninstall snap on Ubuntu.
Supported Systems (v10): Rocky Linux 8/9/10, AlmaLinux 8/9/10, CentOS 7, CentOS Stream 8/9/10, Ubuntu Server 18.04/20.04/22.04/24.04 LTS, Debian 11/12/13, openEuler 22.03/24.03 LTS, AnolisOS 8/23, OpenCloudOS 8/9, openSUSE 15, Kylin Server V10, UOS Server V20.
Version Update Log
v10: Added traditional interface naming (eth0, eth1) for Rocky 9, AlmaLinux 9, CentOS Stream 9/10; switched to configuration‑file based IP handling; updated GRUB handling for UEFI; optimized Ubuntu/Debian IP changes; fixed Ubuntu 22.04 LTS IP reset after reboot; added support for Rocky 10, AlmaLinux 10, Debian 13; numerous bug fixes; provided reset script links.
UOS Server: Added support for UOS Server V20; added GRUB handling for UEFI; fixed interface‑naming bugs; reset script link provided.
Kylin Server: Added support for Kylin Server V10; added GRUB handling for UEFI; fixed interface‑naming bugs; reset script link provided.
openSUSE: Added support for openSUSE 15; fixed SWAP disabling, Ctrl+Alt+Del disabling, PS1 setting; updated package names (pcre-tools, libopenssl-devel); fixed DNS configuration; bug fixes; reset script link provided.
OpenCloudOS: Added support for OpenCloudOS 8/9; added traditional interface naming (eth0, eth1); unified single/dual NIC configuration via config files; updated GRUB handling for UEFI; bug fixes; reset script link provided.
AnolisOS: Added support for AnolisOS 8/23; added traditional interface naming (eth0, eth1); unified NIC configuration via config files; updated GRUB handling for UEFI; bug fixes; reset script link provided.
openEuler: Added support for openEuler 22.03/24.03 LTS; fixed SWAP disabling and Ctrl+Alt+Del disabling.
v9: Updated CentOS Stream 8/9 repository handling (centos‑vault, epel‑archive); added Ubuntu 24.04 support with netplan and DEB822 repo format; added Debian 11/12 support; added AlmaLinux devel repository; fixed Ctrl+Alt+Del issue; added CentOS Stream 10 support with new repo names; numerous bug fixes; reset script link provided.
v8: Added AlmaLinux 8/9 support; added Ubuntu snap removal feature.
v7: Fixed mirror repository bugs; introduced two reset variants (v7_1 using sed, v7_2 using config files).
v6: Removed CentOS 6/8 due to end‑of‑life.
Earlier versions (v5‑v1): Progressive additions of system‑initialization features such as disabling SELinux, firewall, swap, configuring SSH, setting hostname, managing repositories, installing minimal packages, and more, with incremental support for newer distributions.
Usage Notes
Run the scripts as the root user; Ubuntu and Debian require enabling root login first.
Install lrzsz to transfer the script files, then execute with bash reset_v10.sh. The interactive menu offers 26 options, including NIC renaming, network configuration, hostname setting, repository configuration, firewall and SELinux toggling, swap disabling, timezone setting, kernel and resource tuning, SSH hardening, PS1 customization, default editor selection, history format, and more.
When changing CentOS Stream 9/10 mirrors, ensure update_mirror.pl is present in the same directory as the reset script.
Follow the on‑screen prompts to select actions; choose option 26 to exit the script.
Shell script source code is available at:
Gitee: https://gitee.com/raymond9/shell
GitHub: https://github.com/raymond999999/shellSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Raymond Ops
Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
