在 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(更详细):
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+ 可用)
yum install -y git make gcc
git clone https://github.com/colinianking/cpustat.git
cd cpustat
make
make install
不想装任何东西也可以:
top
htop # yum install -y htop
vmstat 1
| 需求 | 命令 |
|---|---|
| 官方、稳定 | yum install -y sysstat |
| 真·cpustat | 下载二进制 |
| 不想装 | top / vmstat |
如果你告诉我 CentOS 版本(6 / 7 / 8 / Stream),我可以给你最精确的一条命令。