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

相关推荐
我们的五年1 分钟前
【Linux课程学习】:进程描述---PCB(Process Control Block)
linux·运维·c++
我言秋日胜春朝★1 小时前
【Linux】进程地址空间
linux·运维·服务器
繁依Fanyi1 小时前
简易安卓句分器实现
java·服务器·开发语言·算法·eclipse
C-cat.1 小时前
Linux|环境变量
linux·运维·服务器
yunfanleo1 小时前
docker run m3e 配置网络,自动重启,GPU等 配置渠道要点
linux·运维·docker
m51271 小时前
LinuxC语言
java·服务器·前端
运维-大白同学2 小时前
将django+vue项目发布部署到服务器
服务器·vue.js·django
糖豆豆今天也要努力鸭2 小时前
torch.__version__的torch版本和conda list的torch版本不一致
linux·pytorch·python·深度学习·conda·torch
烦躁的大鼻嘎2 小时前
【Linux】深入理解GCC/G++编译流程及库文件管理
linux·运维·服务器
乐大师2 小时前
Deepin登录后提示“解锁登陆密钥环里的密码不匹配”
运维·服务器