確認 CentOS 運行架構對安裝相容套件、編譯程式至關重要。本文提供多種驗證方式,從最簡單的 getconf 到二進位檔案分析,確保資訊準確無誤。
# getconf LONG_BIT
64
輸出 64 即為 64 位元,32 為 32 位元。
# lsb_release -a
LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: CentOS
Description: CentOS release 5.5 (Final)
Release: 5.5
Codename: Final
輸出中含 amd64 或 x86_64 關鍵字即為 64 位元。
# file /bin/ls
/bin/ls: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), dynamically linked, for GNU/Linux 2.6.9, stripped
# uname -a
Linux www 2.6.18-92.el5 #1 SMP Tue Jun 10 18:49:47 EDT 2008 i686 athlon i386 GNU/Linux
# rpm -q centos-release
centos-release-5-4.el5.centos.1
uname -a 輸出末尾的 x86_64 / i686 / i386 直接顯示核心架構。建議交叉驗證至少兩種方式,避免單一指令誤導。