安装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 [email protected]:/magx/Tools/
[email protected]'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 包

相关推荐
每天都要写算法(努力版)42 分钟前
【服务器操作指南】从 Hugging Face 上下载文件 | 从某一个网址上下载文件到 Linux 服务器的指定目录
linux·运维·服务器
天狼12222 小时前
第5章-1 优化服务器设置
运维·服务器·adb
傻啦嘿哟3 小时前
Python正则表达式:用“模式密码“解锁复杂字符串
linux·数据库·mysql
浪裡遊4 小时前
Linux常用指令
linux·运维·服务器·chrome·功能测试
SugarPPig5 小时前
PowerShell 查询及刷新环境变量
服务器
段ヤシ.5 小时前
银河麒麟(内核CentOS8)安装rbenv、ruby2.6.5和rails5.2.6
linux·centos·银河麒麟·rbenv·ruby2.6.5·rails 5.2.6
深夜情感老师7 小时前
centos离线安装ssh
linux·centos·ssh
我的作业错错错7 小时前
搭建私人网站
服务器·阿里云·私人网站
王景程7 小时前
如何测试短信接口
java·服务器·前端
微网兔子8 小时前
伺服器用什么语言开发呢?做什么用什么?
服务器·c++·后端·游戏