1. 查看 centos 版本
cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
2 .查看 ip地址
ip addr
sudo yum install net-tools -y
3. 是否能够上网
ping www.baidu.com
ping 114.114.114.114
sudo systemctl restart network
4. DNS
更新DNS配置
编辑/etc/resolv.conf文件,确保其中包含有效的DNS服务器,例如Google的公共DNS:
sudo vi /etc/resolv.conf
1
添加以下行:
nameserver 8.8.8.8
nameserver 8.8.4.4
yum 指令
sudo yum check-update # 列出所有可更新的软件包
查询 yum 源
sudo yum repolist
yum list
yum provides ifconfig
搜索软件包
sudo yum search epel
#查看更新后的yum源
yum repolist
2、配置EPEL(扩展)源
有些国外的软件在国内的yum源中不一定能找到,所以Linux提供了EPEL(扩展)源,里面都是些国外的软件。
5. 更新YUM仓库源为阿里云镜像源:
Cannot find a valid baseurl for repo: base/7/x86_64
参考文档
CentOS yum源设置为国内aliyun yum源
https://developer.aliyun.com/article/1523301?spm=5176.26934562.main.2.16c938e4ys9prQ
CentOS 镜像
https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.4b2d1b11s6VkHv
备份
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/rep