All-in-One Linux Init Scripts for Rocky, AlmaLinux, CentOS, Ubuntu & More
This article introduces a comprehensive set of shell scripts that automate system initialization across dozens of Linux distributions, detailing supported features, version‑specific updates, usage instructions, and code examples for network, security, package management, and more.
Linux System Initialization Scripts for Multiple Distributions
Shell script source code repositories: Gitee and GitHub . You can pull the scripts from these repositories.
Supported Functions and Distributions
Network configuration (rename NIC, set IP, subnet mask, gateway, DNS, single or dual NIC), hostname, repository mirrors, minimal package installation, firewall disable, SELinux disable, swap disable, timezone, resource limits, kernel parameters, SSH optimization, SSH port change, system alias, vimrc, mail service installation, PS1 prompt, default editor, history format, ctrl+alt+del reboot disable, root login for Ubuntu/Debian, Ubuntu snap removal, and other utilities.
Supported distributions (v10): Rocky Linux 8/9, AlmaLinux 8/9, CentOS 7, CentOS Stream 8/9/10, Ubuntu 18.04/20.04/22.04/24.04, Debian 11/12; openEuler 22.03/24.03; AnolisOS 8/23; OpenCloudOS 8/9; openSUSE 15; Kylin Server V10; Uos Server V20.
Version Update Log
v10: added traditional NIC naming (eth0, eth1) for Rocky 9, AlmaLinux 9, CentOS Stream 9/10; switched IP configuration from nmcli to config files with auto detection of NIC count.
Uos Server: added support for Uos Server V20.
Kylin Server: added support for Kylin Server V10.
openSUSE: added support for openSUSE 15 and fixed SWAP, ctrl+alt+del, PS1, and package name changes.
OpenCloudOS: added support for OpenCloudOS 8/9, fixed SWAP and reboot, added traditional NIC naming for OpenCloudOS 9.
AnolisOS: added support for AnolisOS 8/23, fixed SWAP and reboot, added traditional NIC naming.
openEuler: added support for openEuler 22.03/24.03, fixed SWAP and reboot.
v9: updated CentOS Stream 8/9 repository changes, added Ubuntu 24.04 support, Debian 11/12 support, AlmaLinux devel repo, CentOS Stream 10 support, and other bug fixes.
v8: added AlmaLinux 8/9 support, Ubuntu snap removal.
v7: bug fixes for repository handling, IP setting, system alias, kernel parameters.
v6: removed unsupported CentOS 6/8.
v5–v1: incremental feature additions and bug fixes for firewall, SELinux, SSH, swap, and other system settings.
Usage Notes
Scripts must be run as root.
<code># Example usage on Ubuntu 24.04
sudo apt -y install lrzsz
rz -E # transfer script
bash reset_v10.sh
# Follow the interactive menu to configure the system
</code>For CentOS Stream 9, when changing repository sources, ensure the
update_mirror.plfile is present in the same directory as the reset script.
<code># Example on CentOS 10
dnf -y install lrzsz
rz -E
bash reset_v10.sh
# Choose option 4 to set repository, then follow prompts
</code>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.