安装expect,更换镜像源

随笔记录

目录

[1. 问题描述](#1. 问题描述)

[2. 解决方法](#2. 解决方法)

[2.1 在线安装](#2.1 在线安装)

[2.1.1检查 YUM 源配置](#2.1.1检查 YUM 源配置)

[2.1.2 修改镜像源](#2.1.2 修改镜像源)

[2.1.3 清理 YUM 缓存](#2.1.3 清理 YUM 缓存)

[2.1.4 重试安装](#2.1.4 重试安装)

[2.2 离线安装](#2.2 离线安装)

[2.2.1 使用yumdownloader命令下载:](#2.2.1 使用yumdownloader命令下载:)

[2.2.2 离线安装](#2.2.2 离线安装)

[2.2.3 查询 libtcl8.5.so 依赖包](#2.2.3 查询 libtcl8.5.so 依赖包)

[2.2.4 下载包含 libtcl8.5.so 的包以及 expect 包](#2.2.4 下载包含 libtcl8.5.so 的包以及 expect 包)

[2.2.5 安装离线包](#2.2.5 安装离线包)


1. 问题描述

复制代码
# 安装 expect 包

[root@bogon .ssh]#
[root@bogon .ssh]# yum install expect
Warning: failed loading '/etc/yum.repos.d/CentOS-Stream-8.repo', skipping.
Waiting for process with pid 7851 to finish.
CentOS Stream 8 - Extras                                                                          0.0  B/s |   0  B
Errors during downloading metadata for repository 'extras':
  - Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8-stream&arch=x86_64&repo=extrock [Could not resolve host: mirrorlist.centos.org]
  - Curl error (7): Couldn't connect to server for http://mirrorlist.centos.org/?release=8-stream&arch=x86_64&repo=extrock [Failed to connect to mirrorlist.centos.org port 80: Connection timed out]
Error: Failed to download metadata for repo 'extras': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resome for http://mirrorlist.centos.org/?release=8-stream&arch=x86_64&repo=extras&infra=stock [Could not resolve host: mirros.org]
[root@bogon .ssh]#

2. 解决方法

2.1 在线安装

2.1.1检查 YUM 源配置

复制代码
确保 YUM 源的配置正确。你可以通过查看 /etc/yum.repos.d/ 目录中的 .repo 文件来确认。

运行以下命令检查 YUM 源:

cat /etc/yum.repos.d/CentOS-Stream-8.repo


确保 baseurl 指向有效的镜像地址。

2.1.2 修改镜像源

复制代码
如果你发现当前的镜像源不可用,可以尝试更换为其他镜像地址。以下是一个示例:

[centos-stream8-base]
name=CentOS Stream 8 - Base
baseurl=http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos8
[centos-stream8-extras]
name=CentOS Stream 8 - Extras
baseurl=http://mirror.centos.org/centos/8-stream/Extras/x86_64/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos8
[centos-stream8-appstream]
name=CentOS Stream 8 - AppStream
baseurl=http://mirror.centos.org/centos/8-stream/AppStream/x86_64/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos8

2.1.3 清理 YUM 缓存

复制代码
yum clean all

2.1.4 重试安装

复制代码
执行一下命令安装即可
# yum install expect 

2.2 离线安装

2.2.1 使用yumdownloader命令下载:

复制代码
#  yumdownloader expect


[root@localhost test_logs]#
[root@localhost test_logs]# yumdownloader expect
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
epel/x86_64/metalink                                                                            | 5.1 kB  00:00:00
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
 * base: mirrors.huaweicloud.com
 * epel: ftp-stud.hs-esslingen.de
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
http://mirrors.bfsu.edu.cn/centos/7.9.2009/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.

http://mirrors.qlu.edu.cn/centos/7.9.2009/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
base                                                                                            | 3.6 kB  00:00:00
http://mirrors.bfsu.edu.cn/centos/7.9.2009/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://mirrors.qlu.edu.cn/centos/7.9.2009/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
extras                                                                                          | 2.9 kB  00:00:00
http://mirrors.bfsu.edu.cn/centos/7.9.2009/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://mirrors.qlu.edu.cn/centos/7.9.2009/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
updates                                                                                         | 2.9 kB  00:00:00
expect-5.45-14.el7_1.x86_64.rp FAILED
http://mirrors.bfsu.edu.cn/centos/7.9.2009/os/x86_64/Packages/expect-5.45-14.el7_1.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
expect-5.45-14.el7_1.x86_64.rp FAILED
http://mirrors.qlu.edu.cn/centos/7.9.2009/os/x86_64/Packages/expect-5.45-14.el7_1.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
expect-5.45-14.el7_1.x86_64.rpm                                                                 | 262 kB  00:00:00

# 已下载离线安装包
[root@localhost test_logs]
[root@localhost test_logs]# ll
total 1300
-rw-r--r--. 1 root    root    268656 Jun 24  2015 expect-5.45-14.el7_1.x86_64.rpm   # 
-rw-r--r--. 1 tcpdump tcpdump 263806 Apr  9 17:46 receive_s0f1_0409_1.pcap
-rw-r--r--. 1 tcpdump tcpdump 262834 Apr 10 09:39 receive_s0f1_0410.pcap
-rw-r--r--. 1 tcpdump tcpdump 262118 Apr  9 17:46 send_s0f0_679_0409_1.pcap
-rw-r--r--. 1 tcpdump tcpdump 262912 Apr 10 09:39 send_s0f0_679_0410.pcap
[root@localhost test_logs]#

2.2.2 离线安装

复制代码
将离线安装包 *.rpm 复制到 要安装服务器上,离线安装即可

#  rpm -ivh expect-5.45-14.el7_1.x86_64.rpm

[root@bogon Tools]# ll

-rw-r--r--. 1 root root 268656 Sep 24 00:57 expect-5.45-14.el7_1.x86_64.rpm

[root@bogon Tools]#
[root@bogon Tools]# rpm -ivh expect-5.45-14.el7_1.x86_64.rpm
warning: expect-5.45-14.el7_1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
error: Failed dependencies:
        libtcl8.5.so()(64bit) is needed by expect-5.45-14.el7_1.x86_64
[root@bogon Tools]# 

注意:
此处提示缺少 libtcl8.5.so

所以需要查询 libtcl8.5.so 的包,并一起下载安装

2.2.3 查询 libtcl8.5.so 依赖包

复制代码
查找包含 libtcl8.5.so 的包
# yum whatprovides '*/libtcl8.5.so'

[root@localhost test_logs]#
[root@localhost test_logs]#  yum whatprovides '*/libtcl8.5.so'
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.huaweicloud.com
 * epel: ftp-stud.hs-esslingen.de
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
1:tcl-8.5.13-8.el7.i686 : Tool Command Language, pronounced tickle
Repo        : base
Matched from:
Filename    : /usr/lib/libtcl8.5.so



1:tcl-8.5.13-8.el7.x86_64 : Tool Command Language, pronounced tickle
Repo        : base
Matched from:
Filename    : /usr/lib64/libtcl8.5.so



1:tcl-8.5.13-8.el7.x86_64 : Tool Command Language, pronounced tickle
Repo        : @base
Matched from:
Filename    : /usr/lib64/libtcl8.5.so



[root@localhost test_logs]#

2.2.4 下载包含 libtcl8.5.so 的包以及 expect

复制代码
# yumdownloader tcl-8.5.13-8.el7.x86_64 expect-5.45-14.el7_1.x86_64

[root@localhost test_logs]#
[root@localhost test_logs]# yumdownloader tcl-8.5.13-8.el7.x86_64 expect-5.45-14.el7_1.x86_64
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.huaweicloud.com
 * epel: ftp-stud.hs-esslingen.de
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
tcl-8.5.13-8.el7.x86_64.rpm    FAILED
http://mirrors.bfsu.edu.cn/centos/7.9.2009/os/x86_64/Packages/tcl-8.5.13-8.el7.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.

tcl-8.5.13-8.el7.x86_64.rpm    FAILED
http://mirrors.qlu.edu.cn/centos/7.9.2009/os/x86_64/Packages/tcl-8.5.13-8.el7.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
tcl-8.5.13-8.el7.x86_64.rpm                                                                     | 1.9 MB  00:00:00
[root@localhost test_logs]#
[root@localhost test_logs]#
[root@localhost test_logs]# ll
-rw-r--r--. 1 root    root     268656 Jun 24  2015 expect-5.45-14.el7_1.x86_64.rpm
-rw-r--r--. 1 root    root    1980564 Nov 25  2015 tcl-8.5.13-8.el7.x86_64.rpm


# 将下载的包 复制到需要安装的服务器 10.1.22.18上

[root@localhost test_logs]#
[root@localhost test_logs]#
[root@localhost test_logs]# scp tcl-8.5.13-8.el7.x86_64.rpm root@10.1.22.18:/magx/Tools/
root@10.1.22.18's password:
tcl-8.5.13-8.el7.x86_64.rpm                                                          100% 1934KB  51.1MB/s   00:00
[root@localhost test_logs]#

2.2.5 安装离线包

复制代码
#  rpm -ivh tcl-8.5.13-8.el7.x86_64.rpm expect-5.45-14.el7_1.x86_64.rpm

[root@bogon Tools]#
[root@bogon Tools]# rpm -ivh tcl-8.5.13-8.el7.x86_64.rpm expect-5.45-14.el7_1.x86_64.rpm
warning: tcl-8.5.13-8.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:tcl-1:8.5.13-8.el7               ################################# [ 50%]
   2:expect-5.45-14.el7_1             ################################# [100%]
[root@bogon Tools]#
[root@bogon Tools]#

到此已完成安装expect 包

相关推荐
千百元8 分钟前
centos如何删除恶心定时任务
linux·运维·centos
skywalk816313 分钟前
网站证书自动续订失败的问题解决,原来是续订指令certbot renew出错,导致crontab定时任务续订失败
运维·服务器·证书·certbot
额呃呃17 分钟前
游戏服务器和一般高性能服务器的区别
运维·服务器·游戏
liwulin050634 分钟前
【JAVA】创建一个不需要依赖的websocket服务器接收音频文件
java·服务器·websocket
gaize12131 小时前
服务器分类及区别划分!多样化服务器用途体系架构及层次分类
运维·服务器·架构
oMcLin2 小时前
如何在Manjaro Linux上配置并优化Caddy Web服务器,确保高并发流量下的稳定性与安全性?
linux·服务器·前端
济6172 小时前
linux(第七期)--gcc编译软件-- Ubuntu20.04
linux·运维·服务器
corpse20103 小时前
Linux监控软件Monitorix 安装部署
linux·安全
wdfk_prog3 小时前
[Linux]学习笔记系列 -- [fs]super
linux·笔记·学习
姚青&3 小时前
四.文件处理命令-文本编辑
linux