rocky linux 9.7

📅 2026/7/14 3:28:41 👁️ 阅读次数 📝 编程学习
rocky linux 9.7

 

 

系统登录成功

二、设置IP地址、网关、DNS

说明:Rocky Linux 9.x默认安装好之后启用DHCP自动获取ip地址,我们修改为静态ip

Rocky Linux 9.x放弃了之前的网络配置目录/etc/sysconfig/network-scripts/,采用新的存储目录,进入网络配置文件目录

cd /etc/NetworkManager/system-connections

vi /etc/NetworkManager/system-connections/ens160.nmconnection

[connection]

id=ens160

uuid=7c854b03-05b7-380d-a0de-620bd89382c4

type=ethernet

autoconnect-priority=-999

interface-name=ens160

timestamp=1654435924

[ethernet]

[ipv4]

address1=192.168.3.60/24,192.168.3.1

dns=8.8.8.8

method=manual

[ipv6]

addr-gen-mode=eui64

method=auto

[proxy]

:wq! #保存退出

nmcli n off && nmcli n on #重启网络

nmcli connection reload ens160.nmconnection

nmcli connection up ens160

 

nmcli c reload # 等同于 nmcli connection reload 重启网卡

nmcli c up ens160

 

 

ip addr #用修改后的ip登录系统,查看ip地址

 

四、禁用SELinux

vim /etc/sysconfig/selinux 

vim /etc/sysconfig/selinux 

#
#    grubby --update-kernel ALL --args selinux=0
#
# To revert back to SELinux enabled:
#
#    grubby --update-kernel ALL --remove-args selinux
#
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

 

#重启系统

shutdown -r now

#查看结果为Disabled

getenforce

 

三、设置主机名为www

hostnamectl set-hostname master1.org
[root@localhost ~]# cat /etc/hostname