怪不得oldboy不支持初学者用RHEL。
这段时间在2台虚拟机上分别通过CentOS5.8和RHEL6.0安装nagios的客户端,CentOS一切顺利。但是,RHEL不断给我制造麻烦。前几天在RHEL环境yum安装mysql遇到问题,耽误2天时间。昨晚又因为在RHEL上安装dos2unix命令,昨晚加上今天下午又折腾1个小时。
今天凌晨通过下载软件包,编译安装始终报错。今天下午在百度搜索yum安装这个命令,也不怎么得要领。于是又尝试直接通过yum指定“dos2unix*”(执行“yum -y install dos2unix*”命令),没想到,竟然安装成功,后面的测试也没有问题。
昨晚折腾到0:40,实在不想睡得太晚。虽然有些不甘心,但还是收拾收拾准备就寝。那时候,就又开始犹豫:到底要不要坚持继续在RHEL上安装nagios客户端。即使次日把dos2unix命令成功安装,后面可能还会遇到其它问题。但是,转念再想:发现问题,解决问题的过程,正是自己提高的过程。毕竟,工作基本落实,不再为生计担心。再花些时间解决这类小问题,应该也没什么大不了的。
况且,linux本身就是各类小知识的繁杂集合。如果小问题都不能处理,大问题遇到的时候,更抓瞎。
为什么RHEL6没有dos2unix这个命令呢?是我当初在安装系统的时候没有选择好软件包的原因吗?天知道……
----------------------------------------开始说正事----------------------------------------------
[[email protected]_client02 nagios]# dos2unix /usr/local/nagios/libexec/check_memory.pl -bash: dos2unix: command not found [[email protected]_client02 nagios]# dos2unix /usr/local/nagios/libexec/check_iostat -bash: dos2unix: command not found [[email protected]_client02 nagios]# cd ..
执行dos2unix命令,提示命令没有找到。可能是dos2unix在RHEL环境没有安装。
在百度搜索安装dos2unix命令,根据文档:“http://blog.csdn.net/bluewhale1/article/details/8074978——dos2unix命令找不到怎么办”操作。
在http://linux.softpedia.com/progDownload/Dos2Unix-Download-5519.html下载hd2u-1.0.0.tgz包。
下载页面全部都是英文内容,经过摸索,这里简单说明下载步骤:点击左边的“DOWNLOAD”按纽,右边的“DOWNLOAD LOCATIONS:”才能显示出来。点击“Sources mirror 1(tgz)”链接,进入下一级页面,过一段时间,就会自动弹出下载对话框。
[[email protected]_client02 tools]# wget http://terminus.sk/~hany/_data/hd2u/hd2u-1.0.0.tgz --2014-09-07 00:03:11-- http://terminus.sk/~hany/_data/hd2u/hd2u-1.0.0.tgz Resolving terminus.sk... 92.240.244.10 Connecting to terminus.sk|92.240.244.10|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 54461 (53K) [application/x-gzip] Saving to: `hd2u-1.0.0.tgz‘ 100%[===========================================================================================================================>] 54,461 248K/s in 0.2s 2014-09-07 00:03:28 (248 KB/s) - `hd2u-1.0.0.tgz‘ saved [54461/54461] [[email protected]_client02 tools]# ll hd2u-1.0.0.tgz -rw-r--r-- 1 root root 54461 Mar 15 2005 hd2u-1.0.0.tgz [[email protected]_client02 tools]# tar zxvf hd2u-1.0.0.tgz hd2u-1.0.0/ hd2u-1.0.0/configure hd2u-1.0.0/dos2unix.c hd2u-1.0.0/NEWS hd2u-1.0.0/config.h.in hd2u-1.0.0/packaging/ hd2u-1.0.0/packaging/hd2u.spec hd2u-1.0.0/CREDITS hd2u-1.0.0/configure.in hd2u-1.0.0/README hd2u-1.0.0/COPYING hd2u-1.0.0/AUTHORS hd2u-1.0.0/install-sh hd2u-1.0.0/INSTALL hd2u-1.0.0/Makefile.in hd2u-1.0.0/TODO hd2u-1.0.0/ChangeLog [[email protected]_client02 tools]# cd hd2u-1.0.0 [[email protected]_client02 hd2u-1.0.0]# ./configure Configuring hd2u 1.0.0 checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for a BSD-compatible install... /usr/bin/install -c checking for getopt_long in -lpopt... no configure: error: *** libpopt not found
配置报错。
[[email protected]_client02 hd2u-1.0.0]# make make: *** No targets specified and no makefile found. Stop.
编译也有问题。
在“http://rpm.pbone.net/index.php3/stat/4/idpl/17960519/dir/other/com/popt-1.14-2rt.x86_64.rpm.html”页面下载popt-1.14-2rt.x86_64.rpm包。
在打开的页面里,右键单击“popt-1.14-2rt.x86_64.rpm”链接,在弹出的快捷菜单里选择“复制链接地址”,就可以在linux环境使用wget命令下载这个包。
[[email protected]_client02 hd2u-1.0.0]# wget ftp://ftp.pbone.net/mirror/ftp.sourceforge.net/pub/sourceforge/r/ro/roblinux/64-32_pkg/base/x86_64/popt-1.14-2rt.x86_64.rpm --2014-09-07 00:09:30-- ftp://ftp.pbone.net/mirror/ftp.sourceforge.net/pub/sourceforge/r/ro/roblinux/64-32_pkg/base/x86_64/popt-1.14-2rt.x86_64.rpm => `popt-1.14-2rt.x86_64.rpm‘ Resolving ftp.pbone.net... 85.14.85.4 Connecting to ftp.pbone.net|85.14.85.4|:21... connected. Logging in as anonymous ... Logged in! ==> SYST ... done. ==> PWD ... done. ==> TYPE I ... done. ==> CWD (1) /mirror/ftp.sourceforge.net/pub/sourceforge/r/ro/roblinux/64-32_pkg/base/x86_64 ... done. ==> SIZE popt-1.14-2rt.x86_64.rpm ... 75973 ==> PASV ... done. ==> RETR popt-1.14-2rt.x86_64.rpm ... done. Length: 75973 (74K) (unauthoritative) 100%[===========================================================================================================================>] 75,973 7.21K/s in 10s 2014-09-07 00:10:30 (7.21 KB/s) - `popt-1.14-2rt.x86_64.rpm‘ saved [75973] [[email protected]_client02 hd2u-1.0.0]# ll popt-1.14-2rt.x86_64.rpm -rw-r--r-- 1 root root 75973 Sep 7 00:10 popt-1.14-2rt.x86_64.rpm [[email protected]_client02 hd2u-1.0.0]# mv popt-1.14-2rt.x86_64.rpm ../ [[email protected]_client02 hd2u-1.0.0]# cd .. [[email protected]_client02 tools]# ll popt-1.14-2rt.x86_64.rpm -rw-r--r-- 1 root root 75973 Sep 7 00:10 popt-1.14-2rt.x86_64.rpm [[email protected]_client02 tools]# rpm -ivh popt-1.14-2rt.x86_64.rpm Preparing... ########################################### [100%] package popt-1.14-2rt.x86_64 is intended for a x86_64 architecture file /usr/share/locale/cs/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/da/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/de/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/es/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/fr/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/ga/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/gl/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/hu/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/is/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/it/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/ja/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/ko/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/nb/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/nl/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/pl/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/pt/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/ro/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/ru/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/sk/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/sl/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/sv/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/tr/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/uk/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/vi/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/wa/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686 file /usr/share/locale/zh_CN/LC_MESSAGES/popt.mo from install of popt-1.14-2rt.x86_64 conflicts with file from package popt-1.13-7.el6.i686
通过输出发现,这个包应该是用于64位系统,而虚拟机里的RHEL是32位系统。安装也有问题。
[[email protected]_client02 tools]# cd hd2u-1.0.0 [[email protected]_client02 hd2u-1.0.0]# ./configure Configuring hd2u 1.0.0 checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for a BSD-compatible install... /usr/bin/install -c checking for getopt_long in -lpopt... no configure: error: *** libpopt not found [[email protected]_client02 hd2u-1.0.0]# make make: *** No targets specified and no makefile found. Stop. [[email protected]_client02 hd2u-1.0.0]# make install make: *** No rule to make target `install‘. Stop. [[email protected]_client02 hd2u-1.0.0]# cd ..
配置、编译和安装都有报错。
也尝试找过32位版本的这个软件包,但不知道是找到的版本有问题,还是版本号不一致。都是在执行“rpm -ivh”命令时,没有执行成功。
尝试使用yum安装dos2unix,意外成功。
[[email protected]_client02 tools]# yum -y install dos2unix* Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.grandcloud.cn * extras: ftp.yzu.edu.tw * updates: mirrors.grandcloud.cn base | 3.7 kB 00:00 extras | 3.3 kB 00:00 updates | 3.4 kB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package dos2unix.i686 0:3.1-37.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================================== Installing: dos2unix i686 3.1-37.el6 base 15 k Transaction Summary ===================================================================================================================================================================== Install 1 Package(s) Total download size: 15 k Installed size: 17 k Downloading Packages: dos2unix-3.1-37.el6.i686.rpm | 15 kB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : dos2unix-3.1-37.el6.i686 1/1 Verifying : dos2unix-3.1-37.el6.i686 1/1 Installed: dos2unix.i686 0:3.1-37.el6 Complete! [[email protected]_client02 tools]# whereis dos2unix dos2unix: /usr/bin/dos2unix /usr/share/man/man1/dos2unix.1.gz [[email protected]_client02 tools]# dos2unix /usr/local/nagios/libexec/check_memory.pl dos2unix: converting file /usr/local/nagios/libexec/check_memory.pl to UNIX format ... [[email protected]_client02 tools]# dos2unix /usr/local/nagios/libexec/check_iostat dos2unix: converting file /usr/local/nagios/libexec/check_iostat to UNIX format ...