安装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 包

相关推荐
yuxb731 分钟前
Linux 文本处理与 Shell 编程笔记:正则表达式、sed、awk 与变量脚本
linux·笔记·正则表达式
刘一说12 分钟前
CentOS 系统 Java 开发测试环境搭建手册
java·linux·运维·服务器·centos
wdxylb6 小时前
云原生俱乐部-shell知识点归纳(1)
linux·云原生
飞雪20077 小时前
Alibaba Cloud Linux 3 在 Apple M 芯片 Mac 的 VMware Fusion 上部署的完整密码重置教程(二)
linux·macos·阿里云·vmware·虚拟机·aliyun·alibaba cloud
路溪非溪7 小时前
关于Linux内核中头文件问题相关总结
linux
海绵不是宝宝8178 小时前
连接远程服务器上的 jupyter notebook,解放本地电脑
服务器·jupyter·github
Lovyk10 小时前
Linux 正则表达式
linux·运维
Fireworkitte10 小时前
Ubuntu、CentOS、AlmaLinux 9.5的 rc.local实现 开机启动
linux·ubuntu·centos
sword devil90011 小时前
ubuntu常见问题汇总
linux·ubuntu
ac.char11 小时前
在CentOS系统中查询已删除但仍占用磁盘空间的文件
linux·运维·centos