Rocky 9最小安装后的初始化
1、配置网卡
vi /etc/NetworkManager/system-connections/ens160.nmconnection
[connection] id=ens160 uuid=e870c322-e0a4-3357-9527-6d5aa1067ba9 type=ethernet autoconnect-priority=-999 interface-name=ens160 timestamp=1787595542 [ethernet] [ipv4] address1=192.168.137.11/24 gateway=192.168.137.2 method=manual dns=114.114.114.114;202.207.177.3;8.8.8.8;8.8.4.4 [ipv6] addr-gen-mode=eui64 method=auto [proxy]
配置保存后重启网卡
可执行systemctl restart NetworkManager
也可执行
nmcli connection down ens160
nmcli connection up ens160
2、配置阿里yum源
自动注释 mirrorlist 并启用 baseurl 指向阿里云:
sed -i.bak \
-e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://dl.rockylinux.org/\$contentdir|baseurl=https://mirrors.aliyun.com/rockylinux|g' \
/etc/yum.repos.d/rocky*.repo
或直接新建阿里源配置:
创建 /etc/yum.repos.d/aliyun-rocky.repo:
[baseos] name=Rocky Linux $releasever - BaseOS - Aliyun baseurl=https://mirrors.aliyun.com/rockylinux/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [appstream] name=Rocky Linux $releasever - AppStream - Aliyun baseurl=https://mirrors.aliyun.com/rockylinux/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [extras] name=Rocky Linux $releasever - Extras - Aliyun baseurl=https://mirrors.aliyun.com/rockylinux/$releasever/extras/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
安装扩展yum源
先执行 dnf config-manager --set-enabled crb
再安装 epel-release 并同样替换其 baseurl 为 https://mirrors.aliyun.com/epel/
epel-cisco-openh264.repo 是 EPEL 仓库中专门提供 Cisco 开源 OpenH264 H.264 视频编解码器二进制包的独立子仓库配置文件,位于 /etc/yum.repos.d/ 目录下,随执行 dnf install epel-release 自动安装。为 RHEL/CentOS/Rocky/AlmaLinux 等企业提供版系统提供 Firefox 等应用所需的 OpenH264 插件(解决专利限制问题),非系统运行必需。可以禁用或直接移到bak目录。
dnf clean all
dnf makecache
3、软件更新及安装常用软件包
# 更新所有软件包
dnf update -y
# 安装常用工具
dnf install -y vim wget curl net-tools lsof htop iftop iotop \
bash-completion tar gzip bzip2 unzip zip \
telnet nmap tcpdump bind-utils chrony
systemctl enable --now chronyd

浙公网安备 33010602011771号