Configure Yum,nc,telnet

Source: Internet
Author: User
Tags gpg nameserver

First, the problem of learning

Recently learning a subproject in Hadoop, zookeeper, when testing the "four Word command"---"Echo ruok|nc localhost 2181" , found that the command could not be recognized as shown:

2181-bash:nc:command not found

We can tell from the message that the NC command cannot be found. There are two possible scenarios for this:

(1) Environment variables without the configuration of NC commands;
(2) The system does not have NC command installed;

I took a look at it. There is no NC command in the/usr/bin directory, so I can assume that the reason for this is the second case

Ii. Solutions

Since my Linux (CentOS6.4) does not have the command installed, I need to install the command, which is installed in two ways, both online and after download. The first thing I tried was to install it online by using the Yum command, and because of my system configuration problems and success, I used the second method to install successfully, then went on the internet, which solved the problem of using a method. Here, the record and everyone to share, first of all to introduce the download installation method.

(1) download and install

    : Http://sourceforge.net/projects/netcat/files/netcat/0.7.1/netcat-0.7.1-1.i386.rpm/download

Installation method: 1) After downloading to get a RPM package, such as:netcat-0.7.1-1.i386.rpm
2) upload the package to the Linux directory via WINCP, and the directory I upload is /root/downloads
3) Enter the directory, execute the command:RPM-IHV netcat-0.7.1-1.i386.rpm, install
4) can execute command after successful installation:NC--help, test

(2) online installation

    Online installation requires us to use the Yum command, which is not an example of a NC command because the NC command is already installed by the above method. Let's take another example of remote online command telnet . First we execute the command: Echo ruok|telnet localhost 2181, which also prompts that the command cannot be found as shown:

2181-bash:telnet:command not found

So we also learn to install, in this I use the first method, the steps are as follows:

1) Configure Yum

Yum is a tool for installing and updating software online, using the tool to ensure network connectivity, and an available source of software that can use 163 or Sohu software sources, with the following source addresses:

A:163 's website: http://mirrors.163.com/, click "Fedora Use Help" in the right column after entry, with instructions for use
B:sohu's website: http://mirrors.sohu.com/
C:centos comes with the source

Here I am using the source of CentOS comes with, if use 163 download source, then the steps are as follows:

A: Download Fedora-163.repo and Fedora-updates-163.repo, WINCP into Linux /etc/yum.repos.d/ directory
B: Run the following command to generate the cache:Yum Clean All
Yum Makecache

Following the execution of the above two commands, the results are as follows:

2) Execute command: Yum list telnet*; View the installation package associated with the Telnet, the result is as follows:

 [[email protected] ~]# yum makecacheloaded plugins:fastestmirror, refresh-< Span style= "color: #000000;" >packagekit, securityrepository updates is listed more than once in The configurationdetermining fastest mirrorscould not retrieve mirrorlist Http://mirrorlist.centos.org/?release=6&arch=i386&repo=os error Was14:pycurl ERROR 6- ' error: Cannot find a valid BaseURL for repo: base   /span>             

Note:

Another problem, the following error message is due to the DNS configuration error, I installed the Cent OS 6.4, no graphical interface, this version of the default installation after the configuration file DNS is not configured in.

Workaround:

Use VI to open the configuration file for DNS to modify, execute the command: vi /etc/resolv.conf, add and a few lines of content, here is an example file:
nameserver 8.8.8.8
nameserver 8.8.4.4
Search localdomain
Valid parameters and their meanings are as follows:

name The server indicates the IP address of the DNS server. There can be many rows of nameserver, each with an I-P address. At query time, the order of nameserver in this file is performed, and the following nameserver is queried only if the first nameserver is unresponsive.
domain declares the domain name of the host. Many programs use it, such as a mail system, and are used when DNS queries are made for hosts that do not have a domain name. If there is no domain name, the hostname is used, removing all at the first point (.) The previous content.
search its multiple parameters indicate the order of the domain name query. When you want to query a host that does not have a domain name, the host is found separately in the domain that is declared by search. Domain and search cannot coexist, and if they exist at the same time, subsequent occurrences will be used.
sortlist allows a specific sort of domain results to be obtained. Its parameters are network/mask pairs. Allows arbitrary order of arrangement.

  Execute command again: Yum list telnet*, the result is as follows:

 for Try

Attention:

The reason for this message is that I created a 163 source under the previous/etc/yum.repos.d/, which might be incorrect, remove that source, and run Yum Makecache.

Execute command again: Yum list telnet*, the result is as follows:

[Email protected] network-scripts]#Yum List telnet*Loaded Plugins:fastestmirror, refresh-PackageKit, securityloading mirror speeds fromCached Hostfile*Base: centos.ustc.edu.cn*extras:centos.ustc.edu.cn*updates:centos.ustc.edu.cnAvailable Packagestelnet.i686                                                                        1:0.17- -. El6_3.1                                                                 Base telnet-server.i686                                                              1:0.17- -. El6_3.1                                                                 Base[[Email protected] network-scripts]#

This run succeeds,telnet.i686 represents the client, andtelnet-server.i686 represents the service side. What we need is the client, install telnet.i686 .

3) Execute command: Yum install telnet.i686, the result is as follows:

[Email protected] network-scripts]# Yum Install telnet.i686loaded plugins:fastestmirror, refresh-PackageKit, securityloading mirror speeds fromCached Hostfile*Base: centos.ustc.edu.cn*extras:centos.ustc.edu.cn*updates:centos.ustc.edu.cnSetting up Install processresolving Dependencies-Running Transaction Check---> Package telnet.i6861:0.17- -. El6_3.1Would be installed-finished Dependency resolutiondependencies resolved=============================================================================================================== =========================================================Package Arch Version Repository Size=============================================================================================================== =========================================================installing:telnet i6861:0.17- -. El6_3.1                                  Base                                  $ktransaction Summary=============================================================================================================== =========================================================Install1Package (s) Total Download size: $kinstalled Size:102KIs ThisOK [y/N]: ydownloading packages:telnet-0.17- -. El6_3.1. i686.rpm | $Kbxx:xxWarning:rpmts_HdrFromFdno:Header V3 RSA/SHA1 Signature, key ID c105b9de:nokeyretrieving key fromFile///etc/pki/rpm-gpg/rpm-gpg-key-centos-6Importing GPG Key0xc105b9de: Userid:centos-6Key (CentOS6Official Signing Key) <centos-6[Email protected]>Package:centos-release-6-4. El6.centos.Ten. i686 (@anaconda-centos-201303020136. i386/6.4) From:/etc/pki/rpm-gpg/rpm-gpg-key-centos-6 is ThisOK [y/N]: yrunning rpm_check_debugrunning Transaction testtransaction Test succeededrunning Transactionwarning:rpmdb  Altered outside of Yum. Installing:1: telnet-0.17- -. El6_3.1. i6861/1Verifying:1: telnet-0.17- -. El6_3.1. i6861/1Installed:telnet.i6861:0.17- -. El6_3.1 Complete!
View Code

4) Verify, execute command: Telnet--help, as shown below, indicates the installation was successful.

[[Email protected] network-scripts]# telnet--'-'usage:telnet [-8  Char] [-L user]        [-N tracefile] [-B hostalias] [-R] [host-name [port]][[ Email protected] Network-scripts]#

Configure Yum,nc,telnet

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.