CentOS 7 上使用 yum 安装 htop

在 CentOS 7 上使用 yum 安装 htop 的步骤如下:

1. 首先确保已启用 EPEL 仓库

htop 包含在 EPEL (Extra Packages for Enterprise Linux) 仓库中,需要先启用它:

bash

下载

sudo yum install epel-release

2. 安装 htop

bash

下载

sudo yum install htop

3. 运行 htop

bash

下载

htop

如果遇到问题:

如果提示 "No package htop available":
  1. 确认 EPEL 仓库已正确启用:

    bash

    下载

    yum repolist | grep epel

    应该能看到 epel 仓库列表

  2. 如果看不到 EPEL 仓库,手动启用:

    bash

    下载

    sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
其他安装方式(如果 yum 不可用):
  1. 从源码编译安装:

    bash

    下载

    sudo yum install ncurses-devel
    wget https://hisham.hm/htop/releases/2.2.0/htop-2.2.0.tar.gz
    tar xvf htop-2.2.0.tar.gz
    cd htop-2.2.0
    ./configure && make && sudo make install

htop 基本使用方法:

  • F1 或 h:查看帮助

  • F2:设置显示选项

  • F3 或 /:搜索进程

  • F4 或 \:过滤进程

  • F5:树状显示

  • F6:选择排序字段

  • F9:发送信号(如 kill)

  • q:退出

卸载 htop:

bash

下载

sudo yum remove htop

注意:在最小化安装的 CentOS 7 上,可能需要先安装一些依赖:

bash

下载

sudo yum install ncurses

效果截图:

 安装相关的日志如下

[root@localhost vscode]# yum install epel-release
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 epel-release.noarch.0.7-11 将被 安装
--> 解决依赖关系完成

依赖关系解决

============================================================================================================================
 Package                           架构                        版本                       源                           大小
============================================================================================================================
正在安装:
 epel-release                      noarch                      7-11                       extras                       15 k

事务概要
============================================================================================================================
安装  1 软件包

总下载量:15 k
安装大小: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
  正在安装    : epel-release-7-11.noarch                                                                                1/1
  验证中      : epel-release-7-11.noarch                                                                                1/1

已安装:
  epel-release.noarch 0:7-11

完毕!
[root@localhost vscode]#
[root@localhost vscode]#
[root@localhost vscode]#
[root@localhost vscode]#
[root@localhost vscode]#
[root@localhost vscode]#
[root@localhost vscode]#
[root@localhost vscode]# yum install htop
已加载插件:fastestmirror, langpacks
epel/x86_64/metalink                                                                                 | 5.1 kB  00:00:00
epel                                                                                                 | 4.3 kB  00:00:00
epel/x86_64/primary_db         FAILED                                                     ]  0.0 B/s |  95 kB  --:--:-- ETA
https://mirrors.hostiserver.com/fedora/archive/epel/7/x86_64/repodata/8b9b4a93a490a3787b09f182250cbaba737fc9c51bc560beecf33988d1abce01-primary.sqlite.gz: [Errno 14] HTTPS Error 404 - Not Found
正在尝试其它镜像。
To address this issue please refer to the below knowledge base article

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/

(1/3): epel/x86_64/group                                                                             | 399 kB  00:00:01
(2/3): epel/x86_64/updateinfo                                                                        | 1.0 MB  00:00:06
(3/3): epel/x86_64/primary_db                                                                        | 8.7 MB  00:00:19
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * epel: repo.jing.rocks
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 htop.x86_64.0.2.2.0-3.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

============================================================================================================================
 Package                    架构                         版本                              源                          大小
============================================================================================================================
正在安装:
 htop                       x86_64                       2.2.0-3.el7                       epel                       103 k

事务概要
============================================================================================================================
安装  1 软件包

总下载量:103 k
安装大小:218 k
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/epel/packages/htop-2.2.0-3.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY
htop-2.2.0-3.el7.x86_64.rpm 的公钥尚未安装
htop-2.2.0-3.el7.x86_64.rpm                                                                          | 103 kB  00:00:58
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 检索密钥
导入 GPG key 0x352C64E5:
 用户ID     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 指纹       : 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 软件包     : epel-release-7-11.noarch (@extras)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : htop-2.2.0-3.el7.x86_64                                                                                 1/1
  验证中      : htop-2.2.0-3.el7.x86_64                                                                                 1/1

已安装:
  htop.x86_64 0:2.2.0-3.el7

完毕!
[root@localhost vscode]#
[root@localhost vscode]#
[root@localhost vscode]# yum repolist | grep epel
 * epel: repo.jing.rocks
epel/x86_64           Extra Packages for Enterprise Linux 7 - x86_64      13,791
[root@localhost vscode]#
[root@localhost vscode]#
[root@localhost vscode]#
[root@localhost vscode]# htop

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值