Linux command for centos version

Как узнать версию CentOS

Не все установочные файлы программ или команды для настройки Linux-системы подходят под любую ОС. Чтобы подобрать подходящие инструменты, нужно понимать, какая CentOS версия системы установлена на вашем устройстве. Версию не обязательно запоминать или записывать на бумажном носителе — вы всегда можете обратиться к системе и узнать её. В этой статье мы расскажем, как узнать версию CentOS разными способами.

Проверить версию CentOS можно несколькими способами:

  • через команду rpm,
  • через команду lsb_release,
  • посмотреть данные в файле /etc/centos-release,
  • через команду hostnamectl.

Практически все эти способы позволяют посмотреть не только версии ядра, но и год выпуска обновления.

VPS с установленной CentOS

Закажите сервер с чистой CentOS или панелью
управления ISPmanager всего за пару минут.

Как посмотреть версию CentOS

Способ 1. Как определить версию CentOS с помощью команды rpm

RPM позволяет управлять пакетами для систем на основе Red Hat. С помощью этого инструмента можно посмотреть пакет CentOS, в названии которого будет информация о версии системы.

Узнать версию CentOS можно только из консоли.

Готово, перед вами появится пакет, в названии которого содержится версия выпуска.

Способ 2. Как посмотреть версию CentOS с помощью команды lsb_release

Как посмотреть версию CentOS с помощью команды lsb_release

В строке «Description» вы увидите версию ОС:

Если перед вами появилась ошибка, значит, у вас не установлена утилита lsb_release.

Как установить yum

sudo yum install redhat-lsb-core

Как установить yum 2

Система попросит пароль суперпользователя. Введите его:

Как установить yum 3

Подтвердите начало загрузки. Введите д или y:

Готово, версия Linux CentOS перед вами.

Способ 3. Просмотр версии CentOS в файле /etc/centos-release

Информация об установленной операционной системе хранится в конфигурационных файлах. С помощью команды cat можно просмотреть содержимое файлов и узнать выпуск ОС. Для этого:

Как посмотреть версии CentOS в файле /etc/centos-release

В ответе вы увидите данные о версии CentOS:

Готово, теперь вы знаете, какая версия CentOS установлена на вашем устройстве.

Способ 4: Как посмотреть версию CentOS с помощью команды hostnamectl

hostnamectl — это команда CentOS, которую используют, чтобы узнать имя хоста, параметры виртуализации и архитектуру системы. Среди этих параметров есть и версия операционной системы.

Обратите внимание! В ответе будет показана только ветвь системы, например CentOS 8. Если вам нужна полная информация о версии, например CentOS 8.3.2011, воспользуйтесь командами, описанными в инструкциях выше.

Источник

4 Ways to Check CentOS Version in Linux Command Line

Here are several ways you can check the version of CentOS Linux distribution running on your machine.

CentOS is a great OS when comes to server software because they have longer support cycle and great stable software in the repositories and a larger community. To know more about why CentOS is better, check out this page.

Читайте также:  Nvidia driver 340 linux

It happens most of the time when installing or selecting a software package, one needs to know the version of the CentOS running in their systems to avoid dependency mismatch and other issues.

In this tutorial, I’ll show you some ways by which you can check the version of the CentOS.

How to Check CentOS Version

To check CentOS version, you can use a command like this:

The result will give you the CentOS version number.

[email protected]:~$ lsb_release -d Description: CentOS Linux release 7.14.1234

Before we see other methods to check CentOS version, let’s first understand the version number and what those number means.

CentOS version consists of three parts, which can be best understood with an example. Consider the version:

7.14.1234

  • 7-major release: This is the most important version number because software packages developed for one version may not be supported in other versions. This is because newer versions will have some bugs fixed which are not in new versions and also they will have new features, new packages, and new hooks into the system. So, there will be a problem when running the software intended for other versions and hence can mess up the system.
  • 14-minor release: These are less important, but they are crucial for maintaining major security updates and a few new features.
  • 1234-build number: This is a version for distributing the software with minor security updates and bug fixes. This doesn’t affect the software versions running on the system that much.

Method 1: Using hostnamectl

The hostnamectl command can be used to query and set the hostname for the system. I also display the Version number of the OS running in the system. This Command displays only the major version number.

Your output will be similar to like the one below.

hostnamectl displays the major version number

Method 2: Using rpm package manager

Since os itself considered as a package by most package managers one can query the package manager(rpm in this case) to find the version of the OS.

rpm -q centos-release (or) rpm --query centos-relase
  • rpm is the package manager
  • -q or –-query is the option for querying
  • centos-release is the package that we want to query on

Note: If you need to check any other software replace centos-release with .

Result of the above will be similar to the one below:

rpm command to query the system for version info

Method 3: Refer the files /etc/*release

Every Linux OS hosts teh important and configuration details about itself and packages in /etc/ directory. And so does centOS.

If you issue ls /etc/*release , following files will be listed.

One can guess by the name of the files, they carry information about the system release. You can manually open the files using any text editor and examine the files for version information or cat command can be used to see the contents of the files. If you don’t know what is cat or you want to brush up your cat skills, Check out this detailed guide on using cat command.

Result of the command will be similar to below:

examine /etc/*release files for version information

Method 4: Using lsb_release tool

lsb release command displays important lsb (linux standard base) information and distribution information. But this tool is available inside the package redhat-lsb.

Install the package in your system using the below command to continue (if you don’t have already).

sudo yum install redhat-lsb

As you might have noticed, you need to be a sudoer for running this command as you are installing a package. If you are a sudoer and you want to give someone sudoer rights, learn how to create sudo user. If you are not a sudoer, try contacting your system admin.

Читайте также:  Соединить сеть linux windows

After installing the package, run the below command:

The result will be similar to the one below:

using lsb_release to find version information

This lsb_release command can be used in other distributions as well. For example, you can run it in Debian to check the Debian version.

Congratulations!. By now, you know various ways by which version number of the CentOS can be found.

I hope you found this article useful. If you have any suggestions or comments, feel free to drop them below.

Written by Seeni, a Linux Enthusiast, Software Developer, AI engineer and fond of professional life drama. He is earning new stuff every day and is excited to share those with you. Follow him on twitter @Seeni_Inc

Источник

4 Ways to Check CentOS or RHEL Version

Do you know the version of CentOS/RHEL release you are running on your server? Why is this even important? There are several reasons to keep this information in mind: to quickly gather information about your system; keep up with bug fixes and security updates, and configure correct software repositories for a specific release, among others.

This is probably an easy task for experienced users, but it’s not usually the case for newbies. In this article, we will show how to check the version of CentOS or RHEL Linux installed on your server.

How to Check Linux Kernel Version in CentOS

Knowing the kernel version is just as important as knowing the distro release version. To check Linux kernel version, you can use the uname command.

$ uname -or OR $ uname -a #print all system information

Check Kernel Version in CentOS

From the output of the above command, the CentOS is powered by an old kernel version, to install or upgrade to the latest kernel release, follow the instructions in our article: How to Install or Upgrade to Kernel 4.15 in CentOS 7.

How to Check CentOS or RHEL Release Version

CentOS release version numbers have two parts, a major version such as “6” or “7” and a minor or update version, such as or “6.x” or “7.x”, which correspond to the major version and update set of RHEL receptively, used to build a particular CentOS release.

To elaborate more in this, take for instance CentOS 7.5 is built from the source packages of RHEL 7 update 5 (also known as RHEL version 7.5), which is referred to as a “point release” of RHEL 7.

Let’s take a look at these 4 useful ways to check CentOS or RHEL release version.

1. Using RPM Command

RPM (Red Hat Package Manager) is a popular and core package management utility for Red Hat based systems like (RHEL, CentOS and Fedora), using this rpm command, you will get your CentOS/REHL release version.

$ rpm --query centos-release [On CentOS] $ rpm --query redhat-release [On RHEL] 

Check CentOS Version Using RPM Command

2. Using Hostnamectl Command

hostnamectl command is used to query and set Linux system hostname, and show other system related information, such as operating system release version as shown in the screenshot.

Check CentOS Version Using hostnamectl Command

3. Using lsb_release Command

lsb_release command displays some LSB (Linux Standard Base) and distribution information. On CentOS/REHL 7, the lsb_release command is provided in the redhat-lsb package which you can install it.

$ sudo yum install redhat-lsb

Once you have installed it, you can check your CentOS/REHL version as shown.

Читайте также:  Simply linux установка java

Show CentOS Version

4. Using Distro Release Files

All the above commands retrieve OS release information from a number of system files. You can view the contents of these files directly, using the cat command.

$ cat /etc/centos-release [On CentOS] $ cat /etc/redhat-release [On RHEL] $ cat /etc/system-release $ cat /etc/os-release #contains more information

Check CentOS Release Version

That’s all for now! If you know any other method that should be covered here, let us know via the comment form below. You can also ask any questions related to the topic.

Источник

How to Check CentOS Version?

Home » SysAdmin » How to Check CentOS Version?

There are many reasons why you should know the CentOS version you are running. For example, if you are troubleshooting a system issue, you will want to know.

Also, it’s useful to ensure your Linux operating system is up-to-date. Outdated software can cause serious security risks and vulnerabilities.

In this tutorial, discover four different options on how to check CentOS version.

Instructions on how to check your CentOS version

How to Check CentOS Version From Command Line

lsb Command to Display Details of CentOS Linux Release

LSB (Linux Standard Base) is a joint project of several Linux distributions to standardize software system structure. One of the commands available from the command line lsb_release . The output will indicate which OS version you are running.

1. Before you can use lsb commands, you have to install the package first. Use the following command:

sudo yum install redhat-lsb-core 

2. Type in your sudo password to authorize the installation and then press y and Enter to confirm.
3. View CentOS version information with the command:

Find CentOS Version with the hostnamectl Command

CentOS version 7 and above has the hostnamectl command, which can query and change the hostname and other related settings. It displays information from the /etc/centos-release file, uname –a file and others.

In addition to version number, it indicates which Linux kernel your system is using.

To see these specifics, use the command:

example of centos version number and output

Find CentOS Version with RPM

RPM is a free and open-source package manager created for Red Hat Linux and its related distributions.

With the rpm command, you can find out the full package name and the release version of CentOS you are running.

Example of RPM command to view version of CentOS

Check CentOS Version in Release File

To check which Linux distro and major release version you have installed, open the release file using the command:

The output reveals the name of the operating system, its major release version, and other specifics, as displayed in the image below.

example of Centos command output for operating system and release version

To see the full release version, use the command:

The output reveals the full release version of your operating system, including the:

example of major, minor and Asynchronous release number

Check Linux Kernel Version in CentOS

Knowing the kernel version you are running is often as useful as finding the release version.

Find out which Linux kernel version you running, with the uname command:

The output you receive is the version number of the kernel of your operating system.

In the example displayed below, 3.10.0.957.

example of linux kernel version displayed in CentOS

This article details 4 ways to check CentoOS version installed. Also, you now know how to check the Linux kernel version. To learn how to check the version of other Red Hat based Linux operating systems check our guide on “Check Linux Red Hat (RHEL) Version“.

If you discover you are not using the latest stable version, read our guide on how to update CentOS!

Источник

Оцените статью
Adblock
detector