我在数据中心有一台 CentOS 7 服务器(服务器 X),该服务器有防火墙,因此我无法执行 yum:
# yum search htop
Loaded plugins: fastestmirror
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"
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.163.com
* extras: mirrors.shu.edu.cn
* updates: ftp.sjtu.edu.cn
Warning: No matches found for: htop
No matches found
并且数据中心没有提供代理服务器供我使用 yum 安装任何东西。
但是,我可以通过 Internet + VPN 从家里的电脑 ssh 到服务器 X。
我只是想知道是否有办法利用 ssh 连接来 yum 安装包(或任何其他方法来 yum 安装包)。
这个帖子建议人们使用 RPM 或 DVD 进行安装。
我认为如果没有任何依赖关系,从 RPM 安装很简单,但处理依赖关系会很麻烦。
欢迎任何建议。
提前致谢!
更新 1:我甚至无法 ping 通 mirrorlist.centos.org 的 IP(尽管可以 ping 通):
# ping 85.236.43.108
PING 85.236.43.108 (85.236.43.108) 56(84) bytes of data.
^C
--- 85.236.43.108 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 1999ms
所以DNS解析不是根本原因。
Traceroute 表明流量被阻止:
# traceroute 85.236.43.108
traceroute to 85.236.43.108 (85.236.43.108), 30 hops max, 60 byte packets
1 gateway (172.18.22.254) 3.884 ms 4.100 ms 4.322 ms
2 gateway (172.18.22.254) 3.200 ms !H * *
由于数据中心有防火墙,所以无法出去。服务器 X 本身没有防火墙,也没有 iptable 来阻止出去。
更新 2:下载 rpm 并 rsync 然后安装失败
# yum localinstall /tmp/audit-libs-2.8.1-3.el7.x86_64.rpm --disablerepo=*
Loaded plugins: fastestmirror
Examining /tmp/audit-libs-2.8.1-3.el7.x86_64.rpm: audit-libs-2.8.1-3.el7.x86_64
Marking /tmp/audit-libs-2.8.1-3.el7.x86_64.rpm as an update to audit-libs-2.7.6-3.el7.x86_64
Resolving Dependencies
--> Running transaction check
---> Package audit-libs.x86_64 0:2.7.6-3.el7 will be updated
--> Processing Dependency: audit-libs(x86-64) = 2.7.6-3.el7 for package: audit-2.7.6-3.el7.x86_64
Loading mirror speeds from cached hostfile
---> Package audit-libs.x86_64 0:2.8.1-3.el7 will be an update
--> Finished Dependency Resolution
Error: Package: audit-2.7.6-3.el7.x86_64 (@anaconda)
Requires: audit-libs(x86-64) = 2.7.6-3.el7
Removing: audit-libs-2.7.6-3.el7.x86_64 (@anaconda)
audit-libs(x86-64) = 2.7.6-3.el7
Updated By: audit-libs-2.8.1-3.el7.x86_64 (/audit-libs-2.8.1-3.el7.x86_64)
audit-libs(x86-64) = 2.8.1-3.el7
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
答案1
确保已通过防火墙允许相关连接,否则响应将无法返回