使用Downloadonly 插件下載 RPM 軟件包及其所有依賴包以及利用yum進(jìn)行所需要的rpm包下載,但在CentOS中沒(méi)有安裝yum相應(yīng)工具的情況下需要先安裝yun工具
建議:先修改yum源,一般我愿意使用阿里巴巴的源,修改yum源之前先做好系統(tǒng)原有文件的備份,避免出錯(cuò)可以恢復(fù)(這是個(gè)好習(xí)慣一定要注意,玩Linux系統(tǒng)的都懂)
備份源文件:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
修改yum源(將默認(rèn)的源更換為ailiyun源):
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
附加上國(guó)內(nèi)yum源(個(gè)人使用這個(gè)都能一般rpm都比較全都能下載):
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo (阿里)
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo (網(wǎng)易)
# yum install yum-plugin-downloadonly?????????{使用root權(quán)限用戶執(zhí)行該命令}
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
?* base: mirrors.huaweicloud.com
?* extras: mirrors.huaweicloud.com
?* updates: mirrors.huaweicloud.com
Resolving Dependencies
--> Running transaction check
---> Package yum.noarch 0:3.4.3-161.el7.centos will be updated
---> Package yum.noarch 0:3.4.3-168.el7.centos will be an update
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================
?Package ? ? ? ? Arch ? ? ? ? ? ? ? Version ? ? ? ? ? ? ? ? ? ? ? ? ? ? Repository ? ? ? ?Size
===============================================================================================
Updating:
?yum ? ? ? ? ? ? noarch ? ? ? ? ? ? 3.4.3-168.el7.centos ? ? ? ? ? ? ? ?base ? ? ? ? ? ? 1.2 M
Transaction Summary
===============================================================================================
Upgrade ?1 Package
Total size: 1.2 M
Is this ok [y/d/N]: y? ?{選擇y}
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
? Updating ? : yum-3.4.3-168.el7.centos.noarch ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1/2?
? Cleanup ? ?: yum-3.4.3-161.el7.centos.noarch ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 2/2?
? Verifying ?: yum-3.4.3-168.el7.centos.noarch ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1/2?
? Verifying ?: yum-3.4.3-161.el7.centos.noarch ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 2/2?
Updated:
? yum.noarch 0:3.4.3-168.el7.centos ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
Complete!? ?{工具安裝完成}
yum install yum-utils工具安裝
# yum install yum-utils? ? ? ? {
使用root權(quán)限用戶執(zhí)行該命令}
Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
?* base: mirrors.aliyun.com
?* extras: mirrors.aliyun.com
?* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.31-50.el7 will be updated
---> Package yum-utils.noarch 0:1.1.31-54.el7_8 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================
?Package ? ? ? ? ? ? ? Arch ? ? ? ? ? ? ? Version ? ? ? ? ? ? ? ? ? ? ? Repository ? ? ? ?Size
===============================================================================================
Updating:
?yum-utils ? ? ? ? ? ? noarch ? ? ? ? ? ? 1.1.31-54.el7_8 ? ? ? ? ? ? ? base ? ? ? ? ? ? 122 k
Transaction Summary
===============================================================================================
Upgrade ?1 Package
Total size: 122 k
Is this ok [y/d/N]: y? ? ? ? {選擇y}
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
? Updating ? : yum-utils-1.1.31-54.el7_8.noarch ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1/2?
? Cleanup ? ?: yum-utils-1.1.31-50.el7.noarch ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?2/2?
? Verifying ?: yum-utils-1.1.31-54.el7_8.noarch ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1/2?
? Verifying ?: yum-utils-1.1.31-50.el7.noarch ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?2/2?
Updated:
? yum-utils.noarch 0:1.1.31-54.el7_8 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
Complete!
?
2個(gè)yum工具安裝完后就可以進(jìn)行下載rpm包了兩種方式:
1、yum在線安裝
2、yumdownloader 下載rpm包
例子:直接在線安裝
# yum install lvm2? ? ? ??{
使用root權(quán)限用戶執(zhí)行該命令}
Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
?* base: mirrors.aliyun.com
?* extras: mirrors.aliyun.com
?* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package lvm2.x86_64 7:2.02.180-8.el7 will be updated
---> Package lvm2.x86_64 7:2.02.187-6.el7_9.5 will be an update
--> Processing Dependency: lvm2-libs = 7:2.02.187-6.el7_9.5 for package: 7:lvm2-2.02.187-6.el7_9.5.x86_64
--> Running transaction check
---> Package lvm2-libs.x86_64 7:2.02.180-8.el7 will be updated
---> Package lvm2-libs.x86_64 7:2.02.187-6.el7_9.5 will be an update
--> Processing Dependency: device-mapper-event = 7:1.02.170-6.el7_9.5 for package: 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64
--> Running transaction check
---> Package device-mapper-event.x86_64 7:1.02.149-8.el7 will be updated
---> Package device-mapper-event.x86_64 7:1.02.170-6.el7_9.5 will be an update
--> Processing Dependency: device-mapper-event-libs = 7:1.02.170-6.el7_9.5 for package: 7:device-mapper-event-1.02.170-6.el7_9.5.x86_64
--> Processing Dependency: device-mapper = 7:1.02.170-6.el7_9.5 for package: 7:device-mapper-event-1.02.170-6.el7_9.5.x86_64
--> Running transaction check
---> Package device-mapper.x86_64 7:1.02.149-8.el7 will be updated
--> Processing Dependency: device-mapper = 7:1.02.149-8.el7 for package: 7:device-mapper-libs-1.02.149-8.el7.x86_64
---> Package device-mapper.x86_64 7:1.02.170-6.el7_9.5 will be an update
---> Package device-mapper-event-libs.x86_64 7:1.02.149-8.el7 will be updated
---> Package device-mapper-event-libs.x86_64 7:1.02.170-6.el7_9.5 will be an update
--> Running transaction check
---> Package device-mapper-libs.x86_64 7:1.02.149-8.el7 will be updated
---> Package device-mapper-libs.x86_64 7:1.02.170-6.el7_9.5 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================
?Package ? ? ? ? ? ? ? ? ? ? ? ?Arch ? ? ? ? Version ? ? ? ? ? ? ? ? ? ? ? Repository ? ? Size
===============================================================================================
Updating:
?lvm2 ? ? ? ? ? ? ? ? ? ? ? ? ? x86_64 ? ? ? 7:2.02.187-6.el7_9.5 ? ? ? ? ?updates ? ? ? 1.3 M
Updating for dependencies:
?device-mapper ? ? ? ? ? ? ? ? ?x86_64 ? ? ? 7:1.02.170-6.el7_9.5 ? ? ? ? ?updates ? ? ? 297 k
?device-mapper-event ? ? ? ? ? ?x86_64 ? ? ? 7:1.02.170-6.el7_9.5 ? ? ? ? ?updates ? ? ? 192 k
?device-mapper-event-libs ? ? ? x86_64 ? ? ? 7:1.02.170-6.el7_9.5 ? ? ? ? ?updates ? ? ? 192 k
?device-mapper-libs ? ? ? ? ? ? x86_64 ? ? ? 7:1.02.170-6.el7_9.5 ? ? ? ? ?updates ? ? ? 325 k
?lvm2-libs ? ? ? ? ? ? ? ? ? ? ?x86_64 ? ? ? 7:2.02.187-6.el7_9.5 ? ? ? ? ?updates ? ? ? 1.1 M
Transaction Summary
===============================================================================================
Upgrade ?1 Package (+5 Dependent packages)
Total size: 3.4 M
Is this ok [y/d/N]: y? ? ? ? {選擇y}
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
? Updating ? : 7:device-mapper-libs-1.02.170-6.el7_9.5.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1/12?
? Updating ? : 7:device-mapper-1.02.170-6.el7_9.5.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?2/12?
? Updating ? : 7:device-mapper-event-libs-1.02.170-6.el7_9.5.x86_64 ? ? ? ? ? ? ? ? ? ? ? 3/12?
? Updating ? : 7:device-mapper-event-1.02.170-6.el7_9.5.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ?4/12?
? Updating ? : 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?5/12?
? Updating ? : 7:lvm2-2.02.187-6.el7_9.5.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 6/12?
? Cleanup ? ?: 7:lvm2-2.02.180-8.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 7/12?
? Cleanup ? ?: 7:lvm2-libs-2.02.180-8.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?8/12?
? Cleanup ? ?: 7:device-mapper-event-1.02.149-8.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?9/12?
? Cleanup ? ?: 7:device-mapper-event-libs-1.02.149-8.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ?10/12?
? Cleanup ? ?: 7:device-mapper-1.02.149-8.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 11/12?
? Cleanup ? ?: 7:device-mapper-libs-1.02.149-8.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?12/12?
? Verifying ?: 7:device-mapper-event-1.02.170-6.el7_9.5.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ?1/12?
? Verifying ?: 7:lvm2-libs-2.02.187-6.el7_9.5.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?2/12?
? Verifying ?: 7:device-mapper-1.02.170-6.el7_9.5.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?3/12?
? Verifying ?: 7:device-mapper-event-libs-1.02.170-6.el7_9.5.x86_64 ? ? ? ? ? ? ? ? ? ? ? 4/12?
? Verifying ?: 7:lvm2-2.02.187-6.el7_9.5.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 5/12?
? Verifying ?: 7:device-mapper-libs-1.02.170-6.el7_9.5.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? 6/12?
? Verifying ?: 7:lvm2-2.02.180-8.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 7/12?
? Verifying ?: 7:device-mapper-event-1.02.149-8.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?8/12?
? Verifying ?: 7:lvm2-libs-2.02.180-8.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?9/12?
? Verifying ?: 7:device-mapper-1.02.149-8.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 10/12?
? Verifying ?: 7:device-mapper-libs-1.02.149-8.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?11/12?
? Verifying ?: 7:device-mapper-event-libs-1.02.149-8.el7.x86_64 ? ? ? ? ? ? ? ? ? ? ? ? ?12/12?
Updated:
? lvm2.x86_64 7:2.02.187-6.el7_9.5 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
Dependency Updated:
? device-mapper.x86_64 7:1.02.170-6.el7_9.5 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? device-mapper-event.x86_64 7:1.02.170-6.el7_9.5 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? device-mapper-event-libs.x86_64 7:1.02.170-6.el7_9.5 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? device-mapper-libs.x86_64 7:1.02.170-6.el7_9.5 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? lvm2-libs.x86_64 7:2.02.187-6.el7_9.5 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
Complete!例子:通過(guò)yumdownloader下載rpm包
首先創(chuàng)建一個(gè)文件夾(方便查找已經(jīng)下載rpm包,個(gè)人習(xí)慣不建立在當(dāng)前文件目錄下載也可)
# mkdir lvm2_rpm
進(jìn)入到建立好的文件目錄
# cd /home/rc/lvm2_rpm
# yumdownloader lvm2 --resolve?
Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
?* base: mirrors.aliyun.com
?* extras: mirrors.aliyun.com
?* updates: mirrors.aliyun.com
base ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| 3.6 kB ?00:00:00 ? ??
extras ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| 2.9 kB ?00:00:00 ? ??
updates ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | 2.9 kB ?00:00:00 ? ??
--> Running transaction check
---> Package lvm2.x86_64 7:2.02.187-6.el7_9.5 will be reinstalled
--> Finished Dependency Resolution
lvm2-2.02.187-6.el7_9.5.x86_64.rpm ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| 1.3 MB ?00:00:19 ?
# ll? ? ? ? {通過(guò)ll命令查看,lvm2的rpm包已經(jīng)下載完畢}
total 1356
-rw-r--r--. 1 root root 1387424 Apr 29 ?2021 lvm2-2.02.187-6.el7_9.5.x86_64.rpm文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-684666.html
以上2個(gè)例子供參考,以此類推缺少的rpm包可以用這個(gè)方式進(jìn)行下載。文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-684666.html
到了這里,關(guān)于解決沒(méi)有rpm的困擾 CentOS7下載RPM及其所有的依賴包的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!