Centos6 使用 yum 命令安装软件时报错误
将于2020年12月开始 CentOS6 官方源已从相关软件源中移出,因此正在使用中 yum 安装软件时会出现以下错误:
[root@ora2 ~]# yum install -y vim Loaded plugins: fastestmirror YumRepo Error: All mirror URLs are not using ftp, http[s] or file. Eg. Invalid release/repo/arch combination/ removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
解决方案如下:
step1 关闭 fastestmirrors
执行如下命令:
vi /etc/yum/pluginconf.d/fastestmirror.conf [main] enabled=0 # 把 enabled 选项参数由 1 改为 0 verbose=0 always_print_best_host = true socket_timeout=3 # Relative paths are relative to the cachedir (and so works for users as well # as root). hostfilepath=timedhosts.txt maxhostfileage=10 maxthreads=15 #exclude=.gov, facebook #include_only=.nl,.de,.uk,.ie
step2 设置 yum 源
执行以下命令:
[root@ora1 ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak [root@ora1 ~]# cd /etc/yum.repos.d/ [root@ora1 yum.repos.d]# ls CentOS-Base.repo.bak CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo [root@oracle yum.repos.d]# yum clean all Cleaning repos: Cleaning up Everything [root@oracle yum.repos.d]# yum makecache Metadata Cache Created [root@ora1 yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 102 1749 102 1749 0 0 2096 0 --:--:-- --:--:-- --:--:-- 9825
step3 测试 yum 命令
yum 安装文本编辑器 vim,OK!
[root@ora1 yum.repos.d]# yum install -y wget base | 3.7 kB 00:00 base/primary_db | 4.7 MB 00:03 extras | 3.4 kB 00:00 extras/primary_db | 29 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 12 MB 00:09 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package wget.x86_64 0:1.12-10.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================ Package Arch Version Repository Size =============================================================================================== Installing: wget x86_64 1.12-10.el6 base 484 k Transaction Summary =========================================================================================== Install 1 Package(s) Total download size: 484 k Installed size: 1.8 M Downloading Packages wget-1.12-10.el6.x86_64.rpm | 484 kB 00:00 warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY Retrieving key from http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 Importing GPG key 0xC105B9DE: Userid: "CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>" From : http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : wget-1.12-10.el6.x86_64 1/1 Verifying : wget-1.12-10.el6.x86_64 1/1 Installed: wget.x86_64 0:1.12-10.el6 Complete! [root@ora1 yum.repos.d]# yum install -y vim Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package vim-enhanced.x86_64 2:7.4.629-5.el6_10.2 will be installed --> Processing Dependency: vim-common = 2:7.4.629-5.el6_10.2 for package: 2:vim-enhanced-7.4.629-5.el6_10.2.x86_64 --> Processing Dependency: perl(:MODULE_COMPAT_5.10.1) for package: 2:vim-enhanced-7.4.629-5.el6_10.2.x86_64 --> Processing Dependency: libperl.so()(64bit) for package: 2:vim-enhanced-7.4.629-5.el6_10.2.x86_64 --> Processing Dependency: libgpm.so.2()(64bit) for package: 2:vim-enhanced-7.4.629-5.el6_10.2.x86_64 --> Running transaction check ---> Package gpm-libs.x86_64 0:1.20.6-12.el6 will be installed ---> Package perl.x86_64 4:5.10.1-144.el6 will be installed --> Processing Dependency: perl(version) for package: 4:perl-5.10.1-144.el6.x86_64 --> Processing Dependency: perl(Pod::Simple) for package: 4:perl-5.10.1-144.el6.x86_64 --> Processing Dependency: perl(Module::Pluggable) for package: 4:perl-5.10.1-144.el6.x86_64 ---> Package perl-libs.x86_64 4:5.10.1-144.el6 will be installed ---> Package vim-common.x86_64 2:7.4.629-5.el6_10.2 will be installed --> Processing Dependency: vim-filesystem for package: 2:vim-common-7.4.629-5.el6_10.2.x86_64 --> Running transaction check ---> Package perl-Module-Pluggable.x86_64 1:3.90-144.el6 will be installed ---> Package perl-Pod-Simple.x86_64 1:3.13-144.el6 will be installed --> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.13-144.el6.x86_64 ---> Package perl-version.x86_64 3:0.77-144.el6 will be installed ---> Package vim-filesystem.x86_64 2:7.4.629-5.el6_10.2 will be installed --> Running transaction check ---> Package perl-Pod-Escapes.x86_64 1:1.04-144.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================== Package Arch Version Repository Size ================================================================================================ Installing: vim-enhanced x86_64 2:7.4.629-5.el6_10.2 updates 1.0 M Installing for dependencies: gpm-libs x86_64 1.20.6-12.el6 base 28 k perl x86_64 4:5.10.1-144.el6 base 10 M perl-Module-Pluggable x86_64 1:3.90-144.el6 base 41 k perl-Pod-Escapes x86_64 1:1.04-144.el6 base 33 k perl-Pod-Simple x86_64 1:3.13-144.el6 base 213 k perl-libs x86_64 4:5.10.1-144.el6 base 579 k perl-version x86_64 3:0.77-144.el6 base 52 k vim-common x86_64 2:7.4.629-5.el6_10.2 updates 6.7 M vim-filesystem x86_64 2:7.4.629-5.el6_10.2 updates 15 k Transaction Summary ============================================================================================== Install 10 Package(s) Total download size: 19 M Installed size: 59 M Downloading Packages: (1/10): gpm-libs-1.20.6-12.el6.x86_64.rpm | 28 kB 00:00 (2/10): perl-5.10.1-144.el6.x86_64.rpm | 10 MB 00:05 (3/10): perl-Module-Pluggable-3.90-144.el6.x86_64.rpm | 41 kB 00:00 (4/10): perl-Pod-Escapes-1.04-144.el6.x86_64.rpm | 33 kB 00:00 (5/10): perl-Pod-Simple-3.13-144.el6.x86_64.rpm | 213 kB 00:00 (6/10): perl-libs-5.10.1-144.el6.x86_64.rpm | 579 kB 00:00 (7/10): perl-version-0.77-144.el6.x86_64.rpm | 52 kB 00:00 (8/10): vim-common-7.4.629-5.el6_10.2.x86_64.rpm | 6.7 MB 00:03 (9/10): vim-enhanced-7.4.629-5.el6_10.2.x86_64.rpm | 1.0 MB 00:00 (10/10): vim-filesystem-7.4.629-5.el6_10.2.x86_64.rpm | 15 kB 00:00 ------------------------------------------------------------------------------------------ Total 1.7 MB/s | 19 MB 00:11 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : 1:perl-Pod-Escapes-1.04-144.el6.x86_64 1/10 Installing : 4:perl-libs-5.10.1-144.el6.x86_64 2/10 Installing : 1:perl-Module-Pluggable-3.90-144.el6.x86_64 3/10 Installing : 1:perl-Pod-Simple-3.13-144.el6.x86_64 4/10 Installing : 3:perl-version-0.77-144.el6.x86_64 5/10 Installing : 4:perl-5.10.1-144.el6.x86_64 6/10 Installing : gpm-libs-1.20.6-12.el6.x86_64 7/10 Installing : 2:vim-filesystem-7.4.629-5.el6_10.2.x86_64 8/10 Installing : 2:vim-common-7.4.629-5.el6_10.2.x86_64 9/10 Installing : 2:vim-enhanced-7.4.629-5.el6_10.2.x86_64 10/10 Verifying : 2:vim-common-7.4.629-5.el6_10.2.x86_64 1/10 Verifying : 3:perl-version-0.77-144.el6.x86_64 2/10 Verifying : 2:vim-filesystem-7.4.629-5.el6_10.2.x86_64 3/10 Verifying : 4:perl-libs-5.10.1-144.el6.x86_64 4/10 Verifying : gpm-libs-1.20.6-12.el6.x86_64 5/10 Verifying : 4:perl-5.10.1-144.el6.x86_64 6/10 Verifying : 1:perl-Module-Pluggable-3.90-144.el6.x86_64 7/10 Verifying : 1:perl-Pod-Simple-3.13-144.el6.x86_64 8/10 Verifying : 1:perl-Pod-Escapes-1.04-144.el6.x86_64 9/10 Verifying : 2:vim-enhanced-7.4.629-5.el6_10.2.x86_64 10/10 Installed: vim-enhanced.x86_64 2:7.4.629-5.el6_10.2 Dependency Installed: gpm-libs.x86_64 0:1.20.6-12.el6 perl.x86_64 4:5.10.1-144.el6 perl-Module-Pluggable.x86_64 1:3.90-144.el6 perl-Pod-Escapes.x86_64 1:1.04-144.el6 perl-Pod-Simple.x86_64 1:3.13-144.el6 perl-libs.x86_64 4:5.10.1-144.el6 perl-version.x86_64 3:0.77-144.el6 vim-common.x86_64 2:7.4.629-5.el6_10.2 vim-filesystem.x86_64 2:7.4.629-5.el6_10.2 Complete!