LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
楼主: hncw13

怎样知道linux是哪个发行版的,如suse,rh等

[复制链接]
发表于 2008-4-26 14:18:12 | 显示全部楼层
And I do.But I'm suing SUSEopen
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-4-26 17:09:20 | 显示全部楼层
Post by 7dehao;1842691
我想到一个办法,看看有没有chkconfig命令,如果有的话,那么就是redhat/fedora系统


suse上有这个命令,我的好像是slackware的
回复 支持 反对

使用道具 举报

发表于 2008-4-27 10:34:18 | 显示全部楼层
Post by hncw13;1842839
suse上有这个命令,我的好像是slackware的


恩,却是是一个问题。但是你为什么 一定要知道这个发行版是什么呢?
回复 支持 反对

使用道具 举报

发表于 2008-4-27 10:52:28 | 显示全部楼层
But if it is LFS ......
how to know?
回复 支持 反对

使用道具 举报

发表于 2008-4-27 12:36:58 | 显示全部楼层
there is no reliable way to detect this
for example, when installing oracle, oracle installer will check /etc/issue in order to determine whether the system is rhel or whatsoever. If you want to install oracle on other distribution, there are two ways to work around this check,one of them is to copy a valid rhel /etc/issue from elsewhere.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-4-27 14:46:13 | 显示全部楼层
Post by 7dehao;1843031
恩,却是是一个问题。但是你为什么 一定要知道这个发行版是什么呢?


我只是想做程序移植的时候,确定一下目标机器的情况。程序迁移过去后,还是得重新编译一下。
回复 支持 反对

使用道具 举报

发表于 2008-4-27 16:37:56 | 显示全部楼层
基于 rpm 的系统,可以从下面的提要得到发行版:
rpm -qi basesystem
回复 支持 反对

使用道具 举报

发表于 2008-4-28 13:13:37 | 显示全部楼层
没有一个通用的办法,不过可以像 phpsysinfo 这样做一些文件检测

  1. ; linux-distros.ini - Defines known linux distros for phpSysInfo.
  2. ; http://phpsysinfo.sourceforge.net/
  3. ; $Id: distros.ini,v 1.10 2007/10/10 12:16:25 jacky672 Exp $
  4. ;

  5. [Debian]
  6. Name = "Debian"
  7. Image = "Debian.png"
  8. Files = "/etc/debian_release;/etc/debian_version"

  9. [SUSE LINUX]
  10. Image = "Suse.png"
  11. Files = "/etc/SuSE-release;/etc/UnitedLinux-release"

  12. [Mandrage]
  13. Image = "Mandrake.png"
  14. Files = "/etc/mandrake-release"

  15. [MandrivaLinux]
  16. Image = "Mandrake.png"
  17. Files = "/etc/mandrake-release"

  18. [Gentoo]
  19. Image = "Gentoo.png"
  20. Files = "/etc/gentoo-release"

  21. [RedHat]
  22. Image = "Redhat.png"
  23. Files = "/etc/redhat-release;/etc/redhat_version"

  24. [Fedora]
  25. Image = "Fedora.png"
  26. Files = "/etc/fedora-release"

  27. [FedoraCore]
  28. Image = "Fedora.png"
  29. Files = "/etc/fedora-release"

  30. [Slackware]
  31. Image = "Slackware.png"
  32. Files = "/etc/slackware-release;/etc/slackware-version"

  33. [Trustix]
  34. Image = "Trustix.gif"
  35. Files = "/etc/trustix-release;/etc/trustix-version"

  36. [FreeEOS]
  37. Image = "free-eos.png"
  38. Files = "/etc/eos-version"

  39. [Arch]
  40. Image = "Arch.gif"
  41. Files = "/etc/arch-release"

  42. [Cobalt]
  43. Image = "Cobalt.png"
  44. Files = "/etc/cobalt-release"

  45. [LinuxFromScratch]
  46. Image = "lfs.png"
  47. Files = "/etc/lfs-release"

  48. [Rubix]
  49. Image   = "Rubix.png"
  50. Files   = "/etc/rubix-version"

  51. [Ubuntu]
  52. Image = "Ubuntu.gif"
  53. Files = "/etc/lsb-release"

  54. [PLD]
  55. Image = "PLD.gif"
  56. Files = "/etc/pld-release"

  57. [CentOS]
  58. Image = "CentOS.png"
  59. Files = "/etc/redhat-release;/etc/redhat_version"

  60. [RedHatEnterpriseES]
  61. Image = "Redhat.png"
  62. Files = "/etc/redhat-release;/etc/redhat_version"
复制代码

比如有 /etc/debian_release 文件的一般就可认为是 Debian GNU/Linux
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-4-28 21:15:47 | 显示全部楼层
Post by tigatron;1843428
没有一个通用的办法,不过可以像 phpsysinfo 这样做一些文件检测

  1. ; linux-distros.ini - Defines known linux distros for phpSysInfo.
  2. ; http://phpsysinfo.sourceforge.net/
  3. ; $Id: distros.ini,v 1.10 2007/10/10 12:16:25 jacky672 Exp $
  4. ;

  5. [Debian]
  6. Name = "Debian"
  7. Image = "Debian.png"
  8. Files = "/etc/debian_release;/etc/debian_version"

  9. [SUSE LINUX]
  10. Image = "Suse.png"
  11. Files = "/etc/SuSE-release;/etc/UnitedLinux-release"

  12. [Mandrage]
  13. Image = "Mandrake.png"
  14. Files = "/etc/mandrake-release"

  15. [MandrivaLinux]
  16. Image = "Mandrake.png"
  17. Files = "/etc/mandrake-release"

  18. [Gentoo]
  19. Image = "Gentoo.png"
  20. Files = "/etc/gentoo-release"

  21. [RedHat]
  22. Image = "Redhat.png"
  23. Files = "/etc/redhat-release;/etc/redhat_version"

  24. [Fedora]
  25. Image = "Fedora.png"
  26. Files = "/etc/fedora-release"

  27. [FedoraCore]
  28. Image = "Fedora.png"
  29. Files = "/etc/fedora-release"

  30. [Slackware]
  31. Image = "Slackware.png"
  32. Files = "/etc/slackware-release;/etc/slackware-version"

  33. [Trustix]
  34. Image = "Trustix.gif"
  35. Files = "/etc/trustix-release;/etc/trustix-version"

  36. [FreeEOS]
  37. Image = "free-eos.png"
  38. Files = "/etc/eos-version"

  39. [Arch]
  40. Image = "Arch.gif"
  41. Files = "/etc/arch-release"

  42. [Cobalt]
  43. Image = "Cobalt.png"
  44. Files = "/etc/cobalt-release"

  45. [LinuxFromScratch]
  46. Image = "lfs.png"
  47. Files = "/etc/lfs-release"

  48. [Rubix]
  49. Image   = "Rubix.png"
  50. Files   = "/etc/rubix-version"

  51. [Ubuntu]
  52. Image = "Ubuntu.gif"
  53. Files = "/etc/lsb-release"

  54. [PLD]
  55. Image = "PLD.gif"
  56. Files = "/etc/pld-release"

  57. [CentOS]
  58. Image = "CentOS.png"
  59. Files = "/etc/redhat-release;/etc/redhat_version"

  60. [RedHatEnterpriseES]
  61. Image = "Redhat.png"
  62. Files = "/etc/redhat-release;/etc/redhat_version"
复制代码

比如有 /etc/debian_release 文件的一般就可认为是 Debian GNU/Linux



嗯 非常感谢
回复 支持 反对

使用道具 举报

发表于 2008-4-29 23:51:49 | 显示全部楼层
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux unstable (sid)
Release:        unstable
Codename:       sid
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表