CentOS7.6无法安装nginx/htop等常用软件的解决办法

问题描述

安装并配置好系统后,想看看机器的运行情况,预备安装htop,首先看看系统是否已经安装了htop

[[email protected] other]$ htop
-bash: htop: command not found

并没有安装,好吧,直接进行安装

[[email protected] other]$ sudo yum install htop
[sudo] password for topseten: 
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirror.jdcloud.com
 * updates: mirrors.aliyun.com
No package htop available.
Error: Nothing to do

啥?没有可用包?什么情况?难道是我没有更新源吗?试着更新下

[[email protected] other]$ sudo yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirror.jdcloud.com
 * updates: mirrors.aliyun.com
No packages marked for update
[[email protected] other]$ sudo yum upgrade
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirror.jdcloud.com
 * updates: mirrors.aliyun.com
No packages marked for update

咦,奇怪了,没有可更新的包啊,我再查找下试试

[[email protected] other]$ sudo yum search htop
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirror.jdcloud.com
 * updates: mirrors.aliyun.com
Warning: No matches found for: htop
No matches found

还是没有,难道是官方移除了htop包?我试试其他应用看看,安装下nginx试试

[[email protected] other]$ sudo yum install nginx
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirror.jdcloud.com
 * updates: mirrors.aliyun.com
No package nginx available.
Error: Nothing to do

解决问题

还是没有,看来不是包的问题,很可能是系统缺少epel-release,直接安装epel-release

[[email protected] other]$ sudo yum install epel-release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================================================
 Package                                                       Arch                                                    Version                                                Repository                                               Size
============================================================================================================================================================================================================================================
Installing:
 epel-release                                                  noarch                                                  7-11                                                   extras                                                   15 k

Transaction Summary
============================================================================================================================================================================================================================================
Install  1 Package

Total download size: 15 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-11.noarch.rpm                                                                                                                                                                                         |  15 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-11.noarch                                                                                                                                                                                                 1/1 
  Verifying  : epel-release-7-11.noarch                                                                                                                                                                                                 1/1 

Installed:
  epel-release.noarch 0:7-11                                                                                                                                                                                                                

Complete!

执行下更新

yum -y update

再试试看有没有htop了

[[email protected] other]$ yum search htop
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                                                                                                                                 | 5.2 kB  00:00:00     
 * base: mirrors.aliyun.com
 * epel: my.mirrors.thegigabit.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
epel                                                                                                                                                                                                                 | 5.3 kB  00:00:00     
(1/3): epel/x86_64/updateinfo      
| 1.1 MB  00:00:01       
(2/3): epel/x86_64/updateinfo                                                                                                                                                                                        | 1.0 MB  00:00:01     
(3/3): epel/x86_64/primary_db                                                                                                                                                                                        | 6.9 MB  00:00:01     
============================================================================================================ N/S matched: htop =============================================================================================================
htop.x86_64 : Interactive process viewer

  Name and summary matches only, use "search all" for everything.

有了,直接安装

[[email protected] other]$ sudo yum install htop
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: my.mirrors.thegigabit.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package htop.x86_64 0:2.2.0-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================================================
 Package                                                Arch                                                     Version                                                       Repository                                              Size
============================================================================================================================================================================================================================================
Installing:
 htop                                                   x86_64                                                   2.2.0-3.el7                                                   epel                                                   103 k

Transaction Summary
============================================================================================================================================================================================================================================
Install  1 Package

Total download size: 103 k
Installed size: 218 k
Is this ok [y/d/N]: y
Downloading packages:
htop-2.2.0-3.el7.x86_64.rpm                                                                                                                                                                                          | 103 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : htop-2.2.0-3.el7.x86_64                                                                                                                                                                                                  1/1 
  Verifying  : htop-2.2.0-3.el7.x86_64                                                                                                                                                                                                  1/1 

Installed:
  htop.x86_64 0:2.2.0-3.el7                                                                                                                                                                                                                 

Complete!

最后的效果:
《CentOS7.6无法安装nginx/htop等常用软件的解决办法》

总结

为什么CentOS 7.6没有这个epel-release包,暂时不知道原因,后期有时间再进行了解

点赞

Leave a Reply

Your email address will not be published. Required fields are marked *