GNU/Linux >> Linux の 問題 >  >> Linux

CentOS のバージョンを確認する方法

問題をトラブルシューティングしたり、サポート チームに情報を提供したりする際に、正確なカーネル バージョンまたは OS バージョンを知る必要がある場合があります。この投稿は、実行している CentOS または RHEL システムの OS とカーネルのバージョンを判断するのに役立ちます。

Linux システムのバージョンを確認する際には、主に 2 つのチェック事項があります。それらは
1. OS アップデート レベルを確認します
2.実行中のカーネル バージョンを確認する

1. CentOS/RHEL OS の更新レベルを確認する

以下に示す 4 つのファイルは、CentOS/Redhat OS の更新バージョンを提供します。

  • /etc/centos-release
  • /etc/os-release
  • /etc/redhat-release
  • /etc/system-release

CentOS 7.4 システムの上記の各ファイルの内容を以下に示します。

# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)
# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
# cat /etc/system-release
CentOS Linux release 7.4.1708 (Core)

上記の 4 つのファイルは、パッケージ centos-release によって提供されます。

# rpm -ql centos-release | grep release$
/etc/centos-release
/etc/os-release
/etc/redhat-release
/etc/system-release

リリース情報は、rpm データベースで報告されたバージョン管理を確認することで確認できます。例:

# rpm -qf /etc/redhat-release
centos-release-7-4.1708.el7.centos.x86_64

2.実行中のカーネル バージョンを確認する

uname コマンドを使用すると、使用している CentOS カーネルのバージョンとアーキテクチャを確認できます。 uname コマンドの詳細については、「man uname」を実行してください。

例:

# uname -s -r
Linux 3.10.0-693.21.1.el7.x86_64
# uname -a
Linux geeklab 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

カーネルのコンパイル時間を確認します (uname -v ) 既知の値と比較します:

# uname -v
#1 SMP Wed Mar 7 19:03:37 UTC 2018

rpm コマンドを使用してカーネル パッケージを確認することもできます。このコマンドは、インストールされたカーネルに問題がある場合にのみ出力を生成します。

# rpm -q --verify kernel-3.10.0-693.21.1.el7.x86_64

CentOS 7 のバージョンを確認しています

上記のすべてのコマンドとは別に、コマンド「hostnamectl」も使用できます。 」で、CentOS 7 システムの OS バージョン情報を確認できます。例:

# hostnamectl
   Static hostname: geeklab
         Icon name: computer-vm
           Chassis: vm
        Machine ID: f9afeb75a5a382dce8269887a67fbf58
           Boot ID: 668b5c55c6b9438b9356438d8beceec6
    Virtualization: xen
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-693.21.1.el7.x86_64
      Architecture: x86-64

LSB バージョンの確認

centOS のバージョンを確認する別の方法は、「lsb_release」コマンドを使用することです。 lsb_release コマンドは、パッケージ「redhat-lsb」によって提供されます。このパッケージはデフォルトではシステムに存在しない可能性があり、最初にインストールする必要がある場合があります。

# yum install redhat-lsb

lsb_release コマンドの例:

# lsb_release -d
Description:    CentOS Linux release 7.4.1708 (Core)
# lsb_release -r
Release:        7.4.1708
# lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.4.1708 (Core)
Release:        7.4.1708
Codename:       Core

GRUB 構成ファイルで OS のバージョンを確認する

GRUB 構成ファイルを使用して OS のバージョンを確認する方法はお勧めしませんが、参考までにこの方法についてここで言及したいと思います。 GRUB 構成ファイルで「menuentry」(CentOS 7 の場合) と「title」(CentOS 6 の場合) を検索して、OS のバージョンを見つけます。

CentOS 7 の例

# cat /boot/grub2/grub.cfg | grep -w menuentry
menuentry 'CentOS Linux (3.10.0-693.21.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-693.21.1.el7.x86_64-advanced-0f790447-ebef-4ca0-b229-d0aa1985d57f' {
menuentry 'CentOS Linux (3.10.0-693.17.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-693.17.1.el7.x86_64-advanced-0f790447-ebef-4ca0-b229-d0aa1985d57f' {

CentOS 7 の場合、ファイル /boot/grub2/grubenv から現在の kerel バージョンを取得することもできます .例:

# grep saved_entry /boot/grub2/grubenv
saved_entry=CentOS Linux (3.10.0-693.21.1.el7.x86_64) 7 (Core)

CentOS 6 の例

# cat /boot/grub/grub.conf | grep title
title CentOS (2.6.32-696.20.1.el6.x86_64)
title CentOS (2.6.32-696.18.7.el6.x86_64)


Linux
  1. PHPバージョンを確認する方法

  2. TensorFlowバージョンを確認する方法

  3. Redhatのバージョンを確認する方法

  1. Ubuntuのバージョンを確認する方法

  2. CentOSのバージョンを確認する方法は?

  3. CentOSのバージョンを確認する方法

  1. Ubuntuのバージョンを確認する方法

  2. KaliLinuxのバージョンを確認する方法

  3. CentOSバージョンを確認する方法