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

相关推荐
冬天vs不冷37 分钟前
Linux用户与权限管理详解
linux·运维·chrome
凯子坚持 c2 小时前
深入Linux权限体系:守护系统安全的第一道防线
linux·运维·系统安全
✿ ༺ ོIT技术༻2 小时前
C++11:新特性&右值引用&移动语义
linux·数据结构·c++
watermelonoops5 小时前
Deepin和Windows传文件(Xftp,WinSCP)
linux·ssh·deepin·winscp·xftp
疯狂飙车的蜗牛6 小时前
从零玩转CanMV-K230(4)-小核Linux驱动开发参考
linux·运维·驱动开发
远游客07138 小时前
centos stream 8下载安装遇到的坑
linux·服务器·centos
马甲是掉不了一点的<.<8 小时前
本地电脑使用命令行上传文件至远程服务器
linux·scp·cmd·远程文件上传
jingyu飞鸟8 小时前
centos-stream9系统安装docker
linux·docker·centos
超爱吃士力架8 小时前
邀请逻辑
java·linux·后端
LIKEYYLL10 小时前
GNU Octave:特性、使用案例、工具箱、环境与界面
服务器·gnu