CentOS 8已经停止维护无法升级,如何检查CentOS版本?

            CentOS 7 将会在2024年6月30日停止维护(EOL)

    那么怎么知道我们线上正在跑的CentOS是哪个版本呢?文章源自技术奇点-https://www.xerer.com/archives/33365.html

    现在CentOS Linux有4个主要的发布分支,CentOS 5,CentOS 6,CentOS 7和CentOS 8文章源自技术奇点-https://www.xerer.com/archives/33365.html

    从命令行检查CentOS版本

    lsb_release命令显示有关Linux发行版的Linux Standard Base(LSB)信息。文章源自技术奇点-https://www.xerer.com/archives/33365.html

    这是首选方法,无论你运行的是哪种CentOS版本都应该可以使用。文章源自技术奇点-https://www.xerer.com/archives/33365.html

    打开终端并键入以下命令:文章源自技术奇点-https://www.xerer.com/archives/33365.html

    lsb_release -a文章源自技术奇点-https://www.xerer.com/archives/33365.html

    CentOS 8已经停止维护无法升级,如何检查CentOS版本?

    CentOS版本将显示在"description"行中。从上面的输出可以看出我使用的是CentOS Linux 7.5.1804版。文章源自技术奇点-https://www.xerer.com/archives/33365.html

    这些版本号的数字 7.5.1804都指的是什么文章源自技术奇点-https://www.xerer.com/archives/33365.html

    • 7 是CentOS的主要分支
    • 7.5 是CentOS 7的最新次要版本
    • 1804 是次要版本的日期代码,1804表示2018年4月,数字用于指示发布的时间

    如果你在执行命令时看到bash: lsb_release: command not found...,则表示redhat-lsb-core 没有在你的系统上未安装该软件包。你可以使用以下方法安装该软件文章源自技术奇点-https://www.xerer.com/archives/33365.html

    sudo yum install redhat-lsb-core
    

    使用rpm命令检查CentOS版本

    rpm (Red Hat Package Manager)是基于Red Hat的系统(如RHEL,CentOS和Fedora)的软件包管理工具。文章源自技术奇点-https://www.xerer.com/archives/33365.html

    你可以使用rpm工具显示有关centos-release包的信息,其中包括名称中的CentOS版本文章源自技术奇点-https://www.xerer.com/archives/33365.html

    rpm --query centos-release
    
    centos-release-7-18elcentos.x86_64
    

    使用/etc/centos-release文件检查CentOS版本

    /etc/centos-release文件由centos-release包提供。文章源自技术奇点-https://www.xerer.com/archives/33365.html

    要检查CentOS版本,请输入以下命令:文章源自技术奇点-https://www.xerer.com/archives/33365.html

    cat /etc/centos-release
    
    CentOS Linux release 1804 (Core)
    

    使用/etc/os-release文件检查CentOS版本

    /etc/os-release文件存在于运行systemd的所有系统上,并包含操作系统标识数据。文章源自技术奇点-https://www.xerer.com/archives/33365.html

    只有拥有CentOS 7时,此方法才有效文章源自技术奇点-https://www.xerer.com/archives/33365.html

    > 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="
    

    使用hostnamectl命令检查你的CentOS版本

    hostnamectl是一个允许你设置主机名的命令,但你也可以使用它来查找你的CentOS版本文章源自技术奇点-https://www.xerer.com/archives/33365.html

    只有在CentOS 7时,此方法才有效文章源自技术奇点-https://www.xerer.com/archives/33365.html

    > hostnamectl
    Static hostname: localhost.localdomain
             Icon name: computer-vm
               Chassis: vm
            Machine ID: 2849f743fbe74706abaa6cb8b2ae5377
               Boot ID: 8259a43c6265465884920ac6d762ed5e
        Virtualization: kvm
      Operating System: CentOS Linux 7 (Core)
           CPE OS Name: cpe:/o:centos:centos:7
                Kernel: Linux 0-8elx86_64
          Architecture: x86-64
    文章源自技术奇点-https://www.xerer.com/archives/33365.html
    weinxin
    微信公众号
    扫码关注公众号获取资源下载及吃瓜爆料

    发表评论

    匿名网友