先是去RPM Search
下载了wget-1.24.5-2.1.x86_64.rpm这个包,结果安装的时候报一堆错
[root@localhost ~]# rpm -ivh wget-1.24.5-2.1.x86_64.rpm
warning: wget-1.24.5-2.1.x86_64.rpm: Header V3 RSA/SHA512 Signature, key ID 29b700a4: NOKEY
error: Failed dependencies:
libc.so.6(GLIBC_2.33)(64bit) is needed by wget-1.24.5-2.1.x86_64
libc.so.6(GLIBC_2.34)(64bit) is needed by wget-1.24.5-2.1.x86_64
libc.so.6(GLIBC_2.38)(64bit) is needed by wget-1.24.5-2.1.x86_64
libcares.so.2()(64bit) is needed by wget-1.24.5-2.1.x86_64
libcrypto.so.3()(64bit) is needed by wget-1.24.5-2.1.x86_64
libcrypto.so.3(OPENSSL_3.0.0)(64bit) is needed by wget-1.24.5-2.1.x86_64
libidn2.so.0()(64bit) is needed by wget-1.24.5-2.1.x86_64
libidn2.so.0(IDN2_0.0.0)(64bit) is needed by wget-1.24.5-2.1.x86_64
libmetalink.so.3()(64bit) is needed by wget-1.24.5-2.1.x86_64
libpcre2-8.so.0()(64bit) is needed by wget-1.24.5-2.1.x86_64
libproxy.so.1()(64bit) is needed by wget-1.24.5-2.1.x86_64
libproxy.so.1(LIBPROXY_0.4.16)(64bit) is needed by wget-1.24.5-2.1.x86_64
libpsl.so.5()(64bit) is needed by wget-1.24.5-2.1.x86_64
libssl.so.3()(64bit) is needed by wget-1.24.5-2.1.x86_64
libssl.so.3(OPENSSL_3.0.0)(64bit) is needed by wget-1.24.5-2.1.x86_64
rpmlib(PayloadIsZstd) <= 5.4.18-1 is needed by wget-1.24.5-2.1.x86_64
在网上查了,发现我服务器上其实有相应的依赖,就是版本比较老,后来一想,觉得装老版本的wget比较好
阿里镜像下载wget包
centos-7-os-x86_64-Packages安装包下载_开源镜像站-阿里云
这个包就很顺利安装上了
附一个GPT生成的,通过服务器下发rpm包并安装的bash脚本
#!/bin/bash
# 用于发送rpm包并安装
# 获取脚本所在目录
script_dir=$(dirname "$0")
# 检查参数数量是否正确
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <file_name>"
exit 1
fi
# 文件名参数
file_name="$1"
# 定义目标服务器列表
servers=(
"1.1.1.1"
"1.1.1.2"
)
# 定义用户名和密码
username="root"
password="mm123456"
cmd="rpm -ivh $file_name"
# 发送文件给目标服务器
for server in "${servers[@]}"; do
echo "发送文件 $file_name 到服务器 $server"
# 使用 rsync 从脚本所在目录发送文件
rsync "$script_dir/$file_name" "$username@$server:~/"
echo "在服务器 $server 上安装 $file_name"
# 使用 expect 来模拟用户输入密码
expect -c "
spawn ssh $username@$server $cmd
expect {
\"*password:\" {send \"$password\r\"; exp_continue}
\"*yes/no*\" {send \"yes\r\"; exp_continue}
}
interact
"
done
echo "完成文件发送"
以wget-1.14-18.el7_6.1.x86_64.rpm包为例
bash send_rpm_install.sh wget-1.14-18.el7_6.1.x86_64.rpm
就可以愉快的下发rpm包和安装拉