1. 程式人生 > >yum不能使用問題

yum不能使用問題

問題:

[[email protected] yum.repos.d]# yum install wget
已載入外掛:fastestmirror
Loading mirror speeds from cached hostfile
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 To enable Red Hat Subscription Management repositories:
     subscription-manager repos --enable <repo>
 To enable custom repositories:
     yum-config-manager --enable <repo>

 

[[email protected] yum.repos.d]# yum repolist all
已載入外掛:fastestmirror
Loading mirror speeds from cached hostfile
源標識                             源名稱                              狀態
C7.0.1406-base/x86_64              CentOS-7.0.1406 - Base              禁用
C7.0.1406-centosplus/x86_64        CentOS-7.0.1406 - CentOSPlus        禁用
C7.0.1406-extras/x86_64            CentOS-7.0.1406 - Extras            禁用
C7.0.1406-fasttrack/x86_64         CentOS-7.0.1406 - CentOSPlus        禁用
C7.0.1406-updates/x86_64           CentOS-7.0.1406 - Updates           禁用
C7.1.1503-base/x86_64              CentOS-7.1.1503 - Base              禁用
C7.1.1503-centosplus/x86_64        CentOS-7.1.1503 - CentOSPlus        禁用
C7.1.1503-extras/x86_64            CentOS-7.1.1503 - Extras            禁用
C7.1.1503-fasttrack/x86_64         CentOS-7.1.1503 - CentOSPlus        禁用
C7.1.1503-updates/x86_64           CentOS-7.1.1503 - Updates           禁用
C7.2.1511-base/x86_64              CentOS-7.2.1511 - Base              禁用
C7.2.1511-centosplus/x86_64        CentOS-7.2.1511 - CentOSPlus        禁用
C7.2.1511-extras/x86_64            CentOS-7.2.1511 - Extras            禁用
C7.2.1511-fasttrack/x86_64         CentOS-7.2.1511 - CentOSPlus        禁用
C7.2.1511-updates/x86_64           CentOS-7.2.1511 - Updates           禁用
C7.3.1611-base/x86_64              CentOS-7.3.1611 - Base              禁用
C7.3.1611-centosplus/x86_64        CentOS-7.3.1611 - CentOSPlus        禁用
C7.3.1611-extras/x86_64            CentOS-7.3.1611 - Extras            禁用
C7.3.1611-fasttrack/x86_64         CentOS-7.3.1611 - CentOSPlus        禁用
C7.3.1611-updates/x86_64           CentOS-7.3.1611 - Updates           禁用
base-debuginfo/x86_64              CentOS-7 - Debuginfo                禁用
base-source/7                      CentOS-7 - Base Sources             禁用
c7-media                           CentOS-7 - Media                    禁用
centosplus-source/7                CentOS-7 - Plus Sources             禁用
cr/7/x86_64                        CentOS-7 - cr                       禁用
extras-source/7                    CentOS-7 - Extras Sources           禁用
fasttrack/7/x86_64                 CentOS-7 - fasttrack                禁用
updates-source/7                   CentOS-7 - Updates Sources          禁用
repolist: 0

解決方法:

因為我的系統為:centos7   :所以使用檔案:CentOS7-Base-163.repo   下載該檔案到

[[email protected] yum.repos.d]# yum clean all
已載入外掛:fastestmirror
正在清理軟體源: base extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[

[email protected] yum.repos.d]# yum makecache
已載入外掛:fastestmirror
base                                                | 3.6 kB     00:00     
extras                                              | 3.4 kB     00:00     
updates                                             | 3.4 kB     00:00     
(1/12): base/7/x86_64/group_gz                        | 166 kB   00:00     
(2/12): base/7/x86_64/primary_db                      | 5.9 MB   00:00     
(3/12): base/7/x86_64/filelists_db                    | 6.9 MB   00:00     
(4/12): base/7/x86_64/other_db                        | 2.5 MB   00:00     
(5/12): extras/7/x86_64/prestodelta                   | 100 kB   00:00     
(6/12): extras/7/x86_64/filelists_db                  | 603 kB   00:00     
(7/12): extras/7/x86_64/primary_db                    | 205 kB   00:00     
(8/12): extras/7/x86_64/other_db                      | 126 kB   00:00     
(9/12): updates/7/x86_64/prestodelta                  | 679 kB   00:00     
(10/12): updates/7/x86_64/filelists_db                | 3.4 MB   00:00     
(11/12): updates/7/x86_64/other_db                    | 578 kB   00:00     
(12/12): updates/7/x86_64/primary_db                  | 6.0 MB   00:00     
Determining fastest mirrors
元資料快取已建立
[[email protected] yum.repos.d]# yum repolist
已載入外掛:fastestmirror
Loading mirror speeds from cached hostfile
源標識                       源名稱                                   狀態
base/7/x86_64                CentOS-7 - Base - 163.com                9,911
extras/7/x86_64              CentOS-7 - Extras - 163.com                434
updates/7/x86_64             CentOS-7 - Updates - 163.com             1,614
repolist: 11,959

上面repolist 顯示安裝成功

測試: yum install wget   則安裝成功

 

 

參考:https://blog.csdn.net/qq_39720249/article/details/84104646