1. yum の紹介
Yum (正式名 Yellow Dog Updater、Modified) は、Fedora、RedHat、SUSE のシェル フロントエンド パッケージ マネージャーです。RPM パッケージ管理に基づいて、指定したサーバーから RPM パッケージを自動的にダウンロードしてインストールし、依存関係を自動的に処理し、面倒なダウンロードとインストールを何度も繰り返すことなく、すべての依存ソフトウェア パッケージを一度にインストールできます。Yum は、特定のソフトウェア パッケージ、グループ、さらにはすべてのソフトウェア パッケージを検索、インストール、削除するコマンドを提供します。
2. 背景
仮想マシンにCentos6.8がインストールされているが、yumソースインストールソフトでエラーが報告され、インストールできないことが判明する
[root@hadoop03 usr]# yum install -y openssh-clients
已加载插件:fastestmirror
设置安装进程
Loading mirror speeds from cached hostfile
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
错误:Cannot find a valid baseurl for repo: base
3. プログラム
3.1 オプション 1
エラーに応じてオンライン資料を確認し、/etc/yum.repos.d/CentOS-Base.repo ミラーソース (Alibaba Cloud Mirror など) を更新することで解決する場合がほとんどですが、操作は次のとおりです。
#1.首先备份系统自带yum源配置文件/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
#2、进入yum源配置文件所在的文件夹
cd /etc/yum.repos.d/
#3、查看CentOS系统版本
lsb_release -a
#4、下载ailiyun的yum源配置文件到/etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
-bash: wget: command not found
「-bash: wget: コマンドが見つかりません」というプロンプトが表示されます。yum ソース自体に問題があるため、yum ソースを通じて wget をダウンロードできない
yum install wget -y
已加载插件:fastestmirror
设置安装进程
Loading mirror speeds from cached hostfile
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
错误:Cannot find a valid baseurl for repo: base
3.2 スキーム 2
まず前のリポジトリをバックアップに移動し、次の 2 つのいずれかを選択します。
源一:替换为官方Vault源(海外服务器用)
curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Official.repo
源二:阿里云Vault镜像(国内服务器用)
curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo
yum ソースのダウンロード wget は正常であり、その他の問題は解決されています
yum install wget -y
已加载插件:fastestmirror
设置安装进程
Loading mirror speeds from cached hostfile
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 00:00
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:00
解决依赖关系
--> 执行事务检查
---> Package wget.x86_64 0:1.12-10.el6 will be 安装
--> 完成依赖关系计算
依赖关系解决
===================================================================================================================================================================================================================================
软件包 架构 版本 仓库 大小
===================================================================================================================================================================================================================================
正在安装:
wget x86_64 1.12-10.el6 base 484 k
事务概要
===================================================================================================================================================================================================================================
Install 1 Package(s)
总下载量:484 k
Installed size: 1.8 M
下载软件包:
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) <[email protected]>"
From : http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
正在安装 : wget-1.12-10.el6.x86_64 1/1
Verifying : wget-1.12-10.el6.x86_64 1/1
已安装:
wget.x86_64 0:1.12-10.el6
完毕!