惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
雷峰网
雷峰网
J
Java Code Geeks
G
Google Developers Blog
博客园 - 司徒正美
The GitHub Blog
The GitHub Blog
L
LangChain Blog
人人都是产品经理
人人都是产品经理
GbyAI
GbyAI
Vercel News
Vercel News
S
SegmentFault 最新的问题
Engineering at Meta
Engineering at Meta
H
Hackread – Cybersecurity News, Data Breaches, AI and More
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
Y
Y Combinator Blog
博客园_首页
Last Week in AI
Last Week in AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
A
About on SuperTechFans
B
Blog
Microsoft Security Blog
Microsoft Security Blog

xnum’s blog

2025/03 初春日本四國遊記 2024/8 菲律賓遊學記 使用DNS紀錄來自動更新IP白名單 lvremove 遇到 contains a filesystem in use 多媒體檔案管理和下載伺服器 - 軟體篇 淘寶退貨 順豐寄回大陸經驗 在dnsmasq加上自動生成PTR紀錄 ultrahuman ring air 台灣購買兼使用心得 AI Singing Voice Conversion (SVC) 的試玩心得
在Linux上面安裝glances並設定為系統服務
Jia Jun Yeh · 2024-05-23 · via xnum’s blog

由於在 Docker 中無法查看某些系統資訊,加上需要指定版本,因此需要進行一個繁瑣的 Python 程式安裝流程。

首先,我們需要建立一個虛擬環境來隔離即將安裝的依賴,以免影響系統的穩定性。

apt install python3 python3-venv

接下來,建立一個虛擬環境:

python3 -m venv /root/_glances
source /root/_glances/bin/activate

接著,安裝 Glances。如果需要使用 Web UI,則需要額外安裝 FastAPI。

pip3 install Glances
pip3 install FastAPI

以下是 systemd 的服務配置檔案,將其放置於 /etc/systemd/system/glances.service

[Unit]
Description=Glances
Documentation=man:glances(1)
Documentation=https://github.com/nicolargo/glances
After=network.target

[Service]
ExecStart=/root/_glances/bin/python3 -m glances -w
Restart=on-abort

[Install]
WantedBy=multi-user.target

完成上述步驟後,啟用並啟動 Glances 服務:

systemctl daemon-reload
systemctl enable glances
systemctl start glances

這樣就完成了在 Linux 上安裝並設定 Glances 為系統服務的步驟。現在,你可以透過 Web UI 來監控你的系統狀態了。