CentoOS6.6安装netcat

时间:2024-01-07 21:53:50

http://blog.csdn.net/u013673976/article/details/47084841

CentOS下安装netcat

使用zookeeper过程中,需要监控集群状态。在使用四字命令时(echo conf | nc localhost 2181),报出如下错误:-bash: netcat: command not found。
我的系统是CentOS 6.6, 64位系统,默认没有安装netcat,下面时安装过程中遇到的一些问题。(下面都是使用root用户)

下载netcat安装包

wget http://sourceforge.NET/projects/netcat/files/netcat/0.7.1/netcat-0.7.1-1.i386.rpm
执行安装rpm -ihv netcat-0.7.1-1.i386.rpm

  1. rpm -ihv netcat-0.7.1-1.i386.rpm
  2. warning: netcat-0.7.1-1.i386.rpm: Header V3 DSA/SHA1 Signature, key ID b2d79fc1: NOKEY
  3. error: Failed dependencies:
  4. libc.so.6 is needed by netcat-0.7.1-1.i386
  5. libc.so.6(GLIBC_2.0) is needed by netcat-0.7.1-1.i386
  6. libc.so.6(GLIBC_2.1) is needed by netcat-0.7.1-1.i386
  7. libc.so.6(GLIBC_2.3) is needed by netcat-0.7.1-1.i386
解决依赖包问题

yum list glibc*

  1. Loaded plugins: fastestmirror, security
  2. Loading mirror speeds from cached hostfile
  3. * base: mirrors.aliyun.com
  4. * extras: mirrors.aliyun.com
  5. * updates: mirrors.aliyun.com
  6. Installed Packages
  7. glibc.x86_64           2.12-1.149.el6        @anaconda-CentOS-201410241409.x86_64/6.6
  8. glibc-common.x86_64    2.12-1.149.el6        @anaconda-CentOS-201410241409.x86_64/6.6
  9. glibc-devel.x86_64     2.12-1.149.el6        @anaconda-CentOS-201410241409.x86_64/6.6
  10. glibc-headers.x86_64   2.12-1.149.el6        @anaconda-CentOS-201410241409.x86_64/6.6
  11. Available Packages
  12. glibc.i686             2.12-1.149.el6_6.9    updates
  13. glibc.x86_64           2.12-1.149.el6_6.9    updates
  14. glibc-common.x86_64    2.12-1.149.el6_6.9    updates
  15. glibc-devel.i686       2.12-1.149.el6_6.9    updates
  16. glibc-devel.x86_64     2.12-1.149.el6_6.9    updates
  17. glibc-headers.x86_64   2.12-1.149.el6_6.9    updates
  18. glibc-static.i686      2.12-1.149.el6_6.9    updates
  19. glibc-static.x86_64    2.12-1.149.el6_6.9    updates
  20. glibc-utils.x86_64     2.12-1.149.el6_6.9    updates

安装命令:
yum install glibc.i686

  1. rpm -ihv netcat-0.7.1-1.i386.rpm
  2. warning: netcat-0.7.1-1.i386.rpm: Header V3 DSA/SHA1 Signature, key ID b2d79fc1: NOKEY
  3. Preparing...                ########################################### [100%]
  4. 1:netcat                 ########################################### [100%]
安装netcat包

rpm -ihv netcat-0.7.1-1.i386.rpm

    1. rpm -ihv netcat-0.7.1-1.i386.rpm
    2. warning: netcat-0.7.1-1.i386.rpm: Header V3 DSA/SHA1 Signature, key ID b2d79fc1: NOKEY
    3. Preparing...                ########################################### [100%]
    4. 1:netcat                 ########################################### [100%]