如何查看Linux操作系统版本,及其版本号含义
1. 查看内核版本命令:
1)cat /proc/version
$ cat /proc/version
Linux version 2.6.32-358.el6.x86_64 (mockbuild@c6b8.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Fri Feb 22 00:31:26 UTC 2013
$ uname -a
Linux 192.168.1.10 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
$ uname -r
2.6.32-358.el6.x86_64
2. 查看Linux版本:
1) 执行 lsb_release -a ,即可列出所有版本信息,例如:
$ lsb_release -a
LSB Version: core-2.0-noarch:core-3.0-noarch:core-2.0-ia32:core-3.0-ia32:graphics-2.0-ia32:graphics-2.0-noarch:graphics-3.0-ia32:graphics-3.0-noarch
Distributor ID: SUSE LINUX
Description: SUSE LINUX Enterprise Server 9 (i586)
Release: 9
Codename: n/a
注:这个命令适用于所有的linux,包括Redhat、SuSE、Debian等发行版。
2) 执行cat /etc/issue,例如如下:
$ cat /etc/issue
Welcome to SUSE LINUX Enterprise Server 9 (i586) - Kernel \r (\l).
3) 执行cat /etc/redhat-release ,例如如下:
$ cat /etc/*release*
CentOS release 6.4 (Final)
CentOS release 6.4 (Final)
CentOS release 6.4 (Final)
cpe:/o:centos:linux:6:GA
--------------------------------------------------以下为个人运行结果----------------------------------------------------------
1. 查看内核版本命令:
1)cat /proc/version
[root@centos6 etc ]#cat /proc/version
Linux version 2.6.32-696.el6.x86_64 (mockbuild@c1bm.rdu2.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) ) #1 SMP Tue Mar 21 19:29:05 UTC 2017
[root@centos7:/etc ]# cat /proc/version
Linux version 3.10.0-862.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) ) #1 SMP Fri Apr 20 16:44:24 UTC 2018
[root@redhat7 ~]#cat /proc/version
Linux version 3.10.0-123.el7.x86_64 (mockbuild@x86-017.build.eng.bos.redhat.com) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Mon May 5 11:16:57 EDT 2014
2. 查看Linux版本:
1)执行lsb_release -a
[root@centos6 ~ ]#lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.9 (Final)
Release: 6.9
Codename: Final
[root@centos7:~ ]# lsb_release -a
bash: lsb_release: command not found...
[root@redhat7 ~]#lsb_release -a
bash: lsb_release: command not found...
上述中的 comand not found... 需要安装lsb安装包,需要手动安装,如下:
[root@centos7:/etc ]# yum provides lsb
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
redhat-lsb-4.1-27.el7.centos.1.x86_64 : Implementation of Linux Standard Base specification
Repo : base
Matched from:
Provides : lsb = 4.1-27.el7.centos.1
具体安装步骤请看本文底下******lsb*****
2)执行cat /etc/redhat-release
[root@centos6 yum.repos.d ]#cat /etc/redhat-release
CentOS release 6.9 (Final)
[root@centos7:/etc ]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@redhat7 ~]#cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)
centos6和centos7中/etc/redhat-release为软链接
[root@centos6 yum.repos.d ]#ll /etc/redhat-release
lrwxrwxrwx. 1 root root 14 May 15 18:48 /etc/redhat-release -> centos-release
[root@centos7:/etc ]# ll /etc/redhat-release
lrwxrwxrwx. 1 root root 14 May 15 18:52 /etc/redhat-release -> centos-release
[root@redhat7 ~]#ll /etc/redhat-release
-rw-r--r--. 1 root root 52 Apr 1 2014 /etc/redhat-release
3)执行cat /etc/issue
[root@centos6 yum.repos.d ]#cat /etc/issue
CentOS release 6.9 (Final)
Kernel \r on an \m
[root@centos7:/etc ]# cat /etc/issue
hostname:\n
tty:\l
time:\t
\S
Kernel \r on an \m
[root@redhat7 ~]#cat /etc/issue
\S
Kernel \r on an \m
************************************************lsb安装**********************************************
[root@centos7:/etc/yum.repos.d ]# df |grep media
/dev/sr0 9176232 9176232 0 100% /media
[root@centos7:/etc/yum.repos.d ]# ls /media/
CentOS_BuildTag EFI EULA GPL images isolinux LiveOS Packages repodata RPM-GPG-KEY-CentOS-7 RPM-GPG-KEY-CentOS-Testing-7 TRANS.TBL
[root@centos7:/etc/yum.repos.d ]# cat base.repo
[base]
name=redhat
baseurl=file:///media/
gpgcheck=0
[base1]
name=http172
baseurl=http://172.18.0.1/centos/$releasever
enabled=1
gpgcheck=0
[epel]
name=education centos7 $releasever $basearch dvdepl
baseurl=http://172.18.0.1/epel/$releasever/$basearch
enbabled=1
gpgcheck=0
name=education centos7 $releasever $basearch dvdepl
baseurl=http://172.18.0.1/epel/$releasever/$basearch
enbabled=1
gpgcheck=0
[root@centos7:/etc/yum.repos.d ]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
base | 3.6 kB 00:00:00
base1 | 3.6 kB 00:00:00
epel | 4.4 kB 00:00:00
(1/4): base/group_gz | 166 kB 00:00:00
(2/4): base1/7/group_gz | 166 kB 00:00:00
(3/4): epel/7/x86_64/group_gz | 250 kB 00:00:00
(4/4): epel/7/x86_64/primary_db | 3.3 MB 00:00:00
(1/2): epel/7/x86_64/updateinfo | 34 kB 00:00:00
(2/2): epel/7/x86_64/pkgtags | 1.2 MB 00:00:00
repo id repo name status
base redhat 9,911
base1/7 http172 9,911
epel/7/x86_64 education centos7 7 x86_64 dvdepl 5,919
repolist: 25,741
[root@centos7:/etc/yum.repos.d ]# yum provides lsb
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
redhat-lsb-4.1-27.el7.centos.1.x86_64 : Implementation of Linux Standard Base specification
Repo : base
Matched from:
Provides : lsb = 4.1-27.el7.centos.1
redhat-lsb-4.1-27.el7.centos.1.x86_64 : Implementation of Linux Standard Base specification
Repo : base1
Matched from:
Provides : lsb = 4.1-27.el7.centos.1
[root@centos7:/etc/yum.repos.d ]# yum install redhat-lsb
[root@centos7:/etc/yum.repos.d ]# 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.5.1804 (Core)
Release: 7.5.1804
Codename: Core
--------------------------------------------------------------------------------------------------------------
linux内核版本号含义
linux version 2.6.32-696.e16.x86_64 为上面centos6运行cat /etc/proc/version的结果, 其中2表示主版本号,6偶数一般表示稳定版本,32表示修正版本号,696表示次修正次数,e16是centos6系列,x86是_64表示cpu架构为x86,系统为64位
Linux发行版
• Slackware: USE Linux EnterpriseServer (SLES) OpenSUSE桌面
• Debian:ubuntu,mint
• redhat:RHEL: RedHat Enterprise Linux 每18个月发行一个新版本 CentOS:兼容RHEL的格式
中标麒麟:中标软件 Fedora:每6个月发行一个新版本
• Arch Linux:轻量简洁
• Gentoo:极致性能,不提供传统意义的安装程序
• LFS: Linux From scratch 自制Linux
• Android: kernel+busybox(工具集)+java虚拟机
• Linux分支参考网站:http://futurist.se/gldt/
发行版
各种发行版都有自己的版本命名方式,有些通过发布时间来命名,像 archlinux:
archlinux 2008.06
表示2008年6月发布该版本
很多发行版除了版本号,还有发布代号。比如 ubuntu,选择一种动物作为吉祥物^_^!!
7.04 - Feisty Fawn
7.10 - Gutsy Gibbon
8.04 - Hardy Heron
8.101 - Intrepid Ibex2
9.04 - Jaunty Jackalope
1 - Intrepid Ibex2
9.04 - Jaunty Jackalope
1 | 发布时间为 08 年 10 月 |
2 | 无畏的北山羊 |
ubuntu 每6个月发布一次新版,所以比较隆重一点;而 archlinux 是滚动更新,发布新版只是便于新用户安装
一些历史悠久的发行版,倾向使用序数作版本号,例如:
Fedora Core 10
openSUSE 11
Debian 5.0
FreeBSD 8.0
- 严格的说,FreeBSD 并不是 Linux 发行版,因为它使用的不是 Linux 内核
内核
Linux 内核的开发,在两个分支上同时进行,稳定分支和实验分支。稳定分支相当健壮,可用于生产环境;而实验分支中包含一些新的特性,还不够成熟;待实验分支的代码经过充分测试,被证明足够成熟,便会被转移到稳定分支
这种开发模式既保证了有一个可靠的稳定版用于生产,又保证了能够大胆的在内核中应用新技术,大部分开源项目都使用此模式开发(包括 FreeBSD 等)
来看看内核版本号
21.62.273-24-i6865
1.62.273-24-i6865
1 | 主版本号。革命性改进,这个版本号在几年内应该不会升级 |
2 | 次版本号。重大改进,偶数为稳定分支,奇数为实验分支 |
3 | 修正版本号。重大修正 |
4 | 修补版本号。一些 BUGS 的修补 |
5 | 目标架构。i686 表示 intel奔腾Ⅱ或以上级别 CPU |