温馨提示×

centos cpustat怎样安装快

小樊
41
2026-09-15 08:52:02
栏目: 智能运维

在 CentOS 上要快速安装 cpustat,最常用、最省事的方式取决于你想要的是哪一种 cpustat


一、最常见:来自 sysstat 包的 mpstat / sar(推荐)

很多人说的 cpustat 其实是指 CPU 统计工具,CentOS 官方源里最标准的是 sysstat

yum install -y sysstat

安装后可用:

mpstat 1
sar -u 1

最快、最稳定、无需编译


二、真正的 cpustat(Colin Ian King 写的)

如果你要的是 GitHub 上的 cpustat(更详细):

方法 1:直接下载二进制(最快)

yum install -y wget
wget https://github.com/colinianking/cpustat/releases/download/v1.0/cpustat -O /usr/local/bin/cpustat
chmod +x /usr/local/bin/cpustat

验证:

cpustat

⚠️ 需要系统支持(一般 CentOS 7+ 可用)


方法 2:源码编译(不推荐,慢)

yum install -y git make gcc
git clone https://github.com/colinianking/cpustat.git
cd cpustat
make
make install

三、如果只是临时看 CPU 使用

不想装任何东西也可以:

top
htop   # yum install -y htop
vmstat 1

✅ 总结(最快方案)

需求 命令
官方、稳定 yum install -y sysstat
真·cpustat 下载二进制
不想装 top / vmstat

如果你告诉我 CentOS 版本(6 / 7 / 8 / Stream),我可以给你最精确的一条命令。

0