Skip to main content
  1. Errors/

Centos7 换源&更新网络连接

151 words·1 min
Linux
Table of Contents

Cannot find a valid baseurl for repo: centos-sclo-rh/x86_64
#

reset /etc/yum.repos.d/CentOS-Base.repo

[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

清除缓存&重新生成缓存

yum clean all
yum makecache

更新系统

yum update -y

Name or service not known
#

虚拟机设置选择NAT模式

配置centos里面的网络配置文件

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
IPADDR=192.168.139.200
DNS1=114.114.114.114
DNS2=8.8.8.8
GATEWAY=192.168.139.2
NETMASK=255.255.255.0
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=a9dd3578-670f-48ce-9d31-d2513f5abafc
DEVICE=ens33
ONBOOT=yes

关闭NetworkManager服务

systemctl stop NetworkManager
systemctl disable NetworkManager

重新启动网络服务

systemctl restart network
systemctl status network

Related

Linux upgrade gcc g++
115 words·1 min
Linux
Ubuntu gcc 升降级 # 更新系统包
Centos8: Errors during downloading metadata for repository 'base'
87 words·1 min
Linux
Errors during downloading metadata for repository ‘base‘ # CentOS-8 - Base - mirrors.
Upgrade openssh version 9.0 on centos7
200 words·1 min
Linux
Upgrade OpenSSH to 9.
Linux 基础配置及命令行操作
585 words·3 mins
Linux
免密登录配置 # 生成公钥、私钥
PAGECACHE、DENTRIES、INODES
360 words·2 mins
Kiga-Hub
Linux Linux
/proc # /proc 是一个虚拟文件系统,通过对它的读写操作做为与Kernel实体间进行通信的一种手段 通过修改/proc中的文件,来对当前kernel的行为作出调整