yum -y install vim*命令报错“Could not resolve host: ; Unknown error“

时间:2025-03-31 08:48:15

操作系统:Linux centos7

报错内容:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * extras:
 * updates:
/centos/7/os/x86_64/repodata/: [Errno 14] curl#6 - "Could not resolve host: ; Unknown error"
Trying other mirror

解决步骤如下:
1.执行jobs -l

[root@localhost ~]# jobs -l
[1]   1217 Stopped                 sudo yum install vim
[2]   1224 Stopped                 yum -y update
[3]-  1226 Stopped                 yum -y install vim*
[4]+  1228 Stopped                 yum -y install vim*

2.执行kill -9 1217 1224 1226 1228
[root@localhost Packages]# jobs -l
[1]   1217 Stopped                 sudo yum install vim  (wd: ~)
[2]   1224 Stopped                 yum -y update  (wd: ~)
[3]-  1226 Stopped                 yum -y install vim*  (wd: ~)
[4]+  1228 Stopped                 yum -y install vim*  (wd: ~)
[root@localhost Packages]# kill -9 1217 1224 1226 1228
[root@localhost Packages]# 
[1]   Killed                  sudo yum install vim  (wd: ~)
(wd now: /mnt/Packages)
[2]   Killed                  yum -y update  (wd: ~)
(wd now: /mnt/Packages)
[3]-  Killed                  yum -y install vim*  (wd: ~)
(wd now: /mnt/Packages)
[4]+  Killed                  yum -y install vim*  (wd: ~)
(wd now: /mnt/Packages)
[root@localhost Packages]# 
[root@localhost Packages]# 
[root@localhost Packages]# 
[root@localhost Packages]# 
[root@localhost Packages]# jobs -l

3.到cd /etc// 目录下把影响网络的目录全部删除掉,自己新建一个repo
[root@localhost ~]# cd /etc//
[root@localhost ]# ls
                   CentOS-x86_64
         
[root@localhost ]# rm -fr *
[root@localhost ]# ls
[root@localhost ]# vi


        [centos]
        name=centos
        baseurl=file:///mnt
        enabled=1
        gpgcheck=0

4.执行挂载
[root@localhost ]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 979M     0  979M   0% /dev
tmpfs                    991M     0  991M   0% /dev/shm
tmpfs                    991M  9.6M  981M   1% /run
tmpfs                    991M     0  991M   0% /sys/fs/cgroup
/dev/mapper/centos-root  9.8G  8.9G  935M  91% /
/dev/sda1                197M  116M   82M  59% /boot
tmpfs                    199M     0  199M   0% /run/user/0


[root@localhost ]# mount /dev/sr0 /mnt   或者   mount /dev/cdrom /mnt    这两个命令挂载都可以

挂载完成后,进入到/mnt/Packages下边查看vim 命令
[root@localhost ]# cd /mnt
[root@localhost mnt]# ls
CentOS_BuildTag  EFI  EULA  GPL  images  isolinux  LiveOS  Packages  repodata  RPM-GPG-KEY-CentOS-7  RPM-GPG-KEY-CentOS-Testing-7  
[root@localhost mnt]# cd Packages/
[root@localhost Packages]# ls |grep vim
vim-common-7.4.629-7.el7.x86_64.rpm
vim-enhanced-7.4.629-7.el7.x86_64.rpm
vim-filesystem-7.4.629-7.el7.x86_64.rpm
vim-minimal-7.4.629-7.el7.x86_64.rpm
vim-X11-7.4.629-7.el7.x86_64.rpm

然后就可以成功执行yum -y install vim*命令下载vim

达梦数据库 - 新一代大型通用关系型数据库 | 达梦在线服务平台