1、配置静态 IP
1)打开网卡配置文件:
/etc/NetworkManager/system-connections/ens33.nmconnection
[connection]
id=ens33
uuid=7b014901-bd03-37c5-b71d-f9b2a0c19bfc
type=ethernet
autoconnect-priority=-999
interface-name=ens33
timestamp=1675598341
[ethernet]
[ipv4]
#method=auto
# 修改为手动配置
method=manual
# 设置 IP地址、掩码、网关
address=192.168.xxx.xxx/24,192.168.xxx.xxx
# 配置 DNS
dns=223.5.5.5;223.6.6.6
[ipv6]
addr-gen-mode=eui64
method=auto
[proxy]
2)重载配置
$ sudo nmcli c reload
$ sudo nmcli c up ens33
root@localhost ~]# nmcli c -h
Usage: nmcli connection { COMMAND | help }
COMMAND := { show | up | down | add | modify | clone | edit | delete | monitor | reload | load | import | export }
show [--active] [--order <order spec>]
show [--active] [id | uuid | path | apath] <ID> ...
up [[id | uuid | path] <ID>] [ifname <ifname>] [ap <BSSID>] [passwd-file <file with passwords>]
down [id | uuid | path | apath] <ID> ...
add COMMON_OPTIONS TYPE_SPECIFIC_OPTIONS SLAVE_OPTIONS IP_OPTIONS [-- ([+|-]<setting>.<property> <value>)+]
modify [--temporary] [id | uuid | path] <ID> ([+|-]<setting>.<property> <value>)+
clone [--temporary] [id | uuid | path ] <ID> <new name>
edit [id | uuid | path] <ID>
edit [type <new_con_type>] [con-name <new_con_name>]
delete [id | uuid | path] <ID>
monitor [id | uuid | path] <ID> ...
reload
load <filename> [ <filename>... ]
import [--temporary] type <type> file <file to import>
export [id | uuid | path] <ID> [<output file>]
2、配置国内镜像源
1)yum配置文件路径
/etc/yum.repos.d/centos.repo
2) 备份源配置
cp /etc/yum.repos.d/centos.repo /etc/yum.repos.d/centos.repo.bak
3) 配置
中科大源
[baseos]
name=CentOS Stream $releasever - BaseOS
#metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-$stream&arch=$basearch&protocol=https,http
# 配置为中科大源
baseurl=https://mirrors.ustc.edu.cn/centos-stream/9-stream/BaseOS/x86_64/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=1
[baseos-debuginfo]
name=CentOS Stream $releasever - BaseOS - Debug
#metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-debug-$stream&arch=$basearch&protocol=https,http
# 配置为中科大源
baseurl=https://mirrors.ustc.edu.cn/centos-stream/9-stream/BaseOS/x86_64/debug/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
[baseos-source]
name=CentOS Stream $releasever - BaseOS - Source
#metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-source-$stream&arch=source&protocol=https,http
# 配置为中科大源
baseurl=https://mirrors.ustc.edu.cn/centos-stream/9-stream/BaseOS/source/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
[appstream]
name=CentOS Stream $releasever - AppStream
#metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-$stream&arch=$basearch&protocol=https,http
# 配置为中科大源
baseurl=https://mirrors.ustc.edu.cn/centos-stream/9-stream/AppStream/x86_64/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=1
[appstream-debuginfo]
name=CentOS Stream $releasever - AppStream - Debug
#metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-debug-$stream&arch=$basearch&protocol=https,http
# 配置为中科大源
baseurl=https://mirrors.ustc.edu.cn/centos-stream/9-stream/AppStream/x86_64/debug/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
[appstream-source]
name=CentOS Stream $releasever - AppStream - Source
#metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-source-$stream&arch=source&protocol=https,http
# 配置为中科大源
baseurl=https://mirrors.ustc.edu.cn/centos-stream/9-stream/AppStream/source/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
[crb]
name=CentOS Stream $releasever - CRB
#metalink=https://mirrors.centos.org/metalink?repo=centos-crb-$stream&arch=$basearch&protocol=https,http
# 配置为中科大源
baseurl=https://mirrors.ustc.edu.cn/centos-stream/9-stream/CRB/x86_64/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=0
[crb-debuginfo]
name=CentOS Stream $releasever - CRB - Debug
#metalink=https://mirrors.centos.org/metalink?repo=centos-crb-debug-$stream&arch=$basearch&protocol=https,http
# 配置为中科大源
baseurl=https://mirrors.ustc.edu.cn/centos-stream/9-stream/CRB/x86_64/debug/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
[crb-source]
name=CentOS Stream $releasever - CRB - Source
#metalink=https://mirrors.centos.org/metalink?repo=centos-crb-source-$stream&arch=source&protocol=https,http
# 配置为中科大源
baseurl=https://mirrors.ustc.edu.cn/centos-stream/9-stream/CRB/source/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
4)更新缓存
yum makecache && yum update