rocky linux 相关命令
1-网卡:
参考:Vmware下安装Rocky Linux9.4-白眉大叔 (baimeidashu.com)
2、备份及更换系统软件源
备份及更换系统软件源,命令如下
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.aliyun.com/rockylinux|g' \
-i.bak \
/etc/yum.repos.d/[Rr]ocky*.repo
创建新的数据缓存,命令如下
dnf makecache
3、设置防火墙
可选操作,根据实际需求设置
这里演示关闭并禁用firewalld防火墙,使用iptables防火墙。关于iptables和firewalld的区别可自行查找相关资料。
关闭并禁用firewalld防火墙
systemctl stop firewalld
systemctl disable firewalld
使用iptables防火墙(合适的时候使用)一般内网我们用阿里云的白名单
yum -y install iptables-services
systemctl start iptables
iptables -F
systemctl enable iptables
service iptables save
禁用 Selinux
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
grubby --update-kernel ALL --args selinux=0
grubby --info DEFAULT
4、设置时区
检查时区是否是上海
timedatectl
时区如果不是Asia/Shanghai
,使用如下命令设置时区
timedatectl set-timezone Asia/Shanghai
5安装命令
可选操作,最小安装版的Linux,很多软件需要自行安装,根据实际需要安装必要的命令
例如:vim、net-tools
yum update -y
yum install -y vim
yum install -y net-tools
6-关闭swap分区:
临时关闭:
swapoff -a
永久关闭:
欢迎来撩 : 汇总all