rocky linux 初始优化
初始化Rocky Linux系统时,可以执行以下优化步骤:
-
更新系统:
sudo dnf update -y
-
安装必要的工具:
sudo dnf install -y epel-release
sudo dnf install -y deltarpm
-
配置网络(如有需要):
sudo dnf install -y network-scripts
sudo nmcli connection modify "Connection Name" ipv4.method manual ipv4.addresses 192.168.1.10/24 ipv4.gateway 192.168.1.1 ipv4.dns "8.8.8.8,8.8.4.4"
sudo nmcli connection up "Connection Name"
-
设置时区(例如设置为上海时区):
sudo timedatectl set-timezone Asia/Shanghai
-
设置语言环境(例如设置为中文):
sudo localectl set-locale LANG=zh_CN.UTF-8
-
创建普通用户并提升权限:
sudo adduser username
sudo usermod -aG wheel username
-
设置防火墙(如果需要):
sudo dnf install -y firewalld
sudo systemctl enable --now firewalld
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload
-
调整文件描述符限制:
echo "* soft nofile 65535" | sudo tee -a /etc/security/limits.conf
echo "* hard nofile 65535" | sudo tee -a /etc/security/limits.conf
echo "* soft nproc 65535" | sudo tee -a /etc/security/limits.conf
echo "* hard nproc 65535" | sudo tee -a /etc/security/limits.conf
-
调整系统服务:
sudo systemctl disable --now postfix
sudo dnf install -y s-nail
-
清理不必要的模块:
sudo dnf remove -y xfsprogs
这些步骤提供了一个基本的系统优化框架,可以根据具体需求进行调整。