lsb_release
Linux

“lsb_release: command not found” sur CentOS 7/8

lsb_release est une commande qui permet d’afficher des information sur la version de le nom de distribution Linux installé. Dans certain distribution cette commande n’existe pas et l’erreur ci-dessous s’affiche :

[root@server ~]# lsb_release -a
-bash: lsb_release: command not found

Dans ce guide nous allons voir comment résoudre ce problème au niveau de CentOS 7/8 .

Installer lsb_release:

Par défaut le package fournissant cette commande n’est pas installé sur CentOS/RedHat. pour voir le package correspondant à cette commande exécutez la commande ci-dessous :

CentOS 7 :

[root@server ~]# yum whatprovides lsb_release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base: mirror.airenetworks.es
extras: mirror.airenetworks.es
updates: mirror.marwan.ma
base/7/x86_64/filelists_db | 7.2 MB 00:00:05
extras/7/x86_64/filelists_db | 235 kB 00:00:00
updates/7/x86_64/filelists_db | 6.2 MB 00:00:04
redhat-lsb-core-4.1-27.el7.centos.1.i686 : LSB Core module support
Repo : base
Matched from:
Filename : /usr/bin/lsb_release
redhat-lsb-core-4.1-27.el7.centos.1.x86_64 : LSB Core module support
Repo : base
Matched from:
Filename : /usr/bin/lsb_release

CentOS 8 :

[root@server ~]# yum whatprovides lsb_release
Last metadata expiration check: 12 days, 23:44:27 ago on Sat 21 Aug 2021 08:43:07 AM EDT.
redhat-lsb-core-4.1-47.0.1.el8.i686 : LSB Core module support
Repo : ol8_appstream
Matched from:
Filename : /usr/bin/lsb_release
redhat-lsb-core-4.1-47.0.1.el8.x86_64 : LSB Core module support
Repo : ol8_appstream
Matched from:
Filename : /usr/bin/lsb_release

Comme montré ci-dessus, le nom du package est redhat-lsb-core. Pour l’installer taper la commande ci-dessous :

[root@server ~]# yum install redhat-lsb-core
Oracle Linux 8 BaseOS Latest (x86_64) 7.6 kB/s | 3.6 kB 00:00
Oracle Linux 8 BaseOS Latest (x86_64) 892 kB/s | 34 MB 00:39
Oracle Linux 8 Application Stream (x86_64) 8.9 kB/s | 3.9 kB 00:00
Oracle Linux 8 Application Stream (x86_64) 913 kB/s | 26 MB 00:29
Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 8 (x86_64) 7.1 kB/s | 3.0 kB 00:00
Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 8 (x86_64) 1.0 MB/s | 23 MB 00:22
Last metadata expiration check: 0:00:04 ago on Fri 03 Sep 2021 08:29:53 AM EDT.
Dependencies resolved.

Ou avec la commande dnf :

[root@server ~]# dnf install redhat-lsb-core

La commande devrait fonctionner maintenant :

[root@server ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: OracleServer
Description: Oracle Linux Server release 8.4
Release: 8.4
Codename: n/a

Vous pouvez utiliser lsb_release avec plusieurs options :

[root@server ~]# lsb_release --help
FSG lsb_release v2.0 prints certain LSB (Linux Standard Base) and
Distribution information.
Usage: lsb_release [OPTION]…
With no OPTION specified defaults to -v.
Options:
-v, --version
Display the version of the LSB specification against which the distribution is compliant.
-i, --id
Display the string id of the distributor.
-d, --description
Display the single line text description of the distribution.
-r, --release
Display the release number of the distribution.
-c, --codename
Display the codename according to the distribution release.
-a, --all
Display all of the above information.
-s, --short
Use short output format for information requested by other options (or version if none).
-h, --help
Display this message.

You might also like

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *