Linux安装telnet

安装环境:CentOS 6.4 
 
memcached的安装,要测试Memcached功能的时候,需要使用到telnet服务.于是就有了本篇
 
一、安装telnet
1、检测telnet-server的rpm包是否安装 

[root@localhost ~]# rpm -qa telnet-server 
若无输入内容,则表示没有安装。出于安全考虑telnet-server.rpm是默认没有安装的,而telnet的客户端是标配。即下面的软件是默认安装的。

2、若未安装,则安装telnet-server,否则忽略此步骤

[root@localhost ~]#yum install telnet-server  
 
 
3、检测telnet-server的rpm包是否安装 

[root@localhost ~]# rpm -qa telnet 
telnet-0.17-47.el6_3.1.x86_64

4、若未安装,则安装telnet,否则忽略此步骤

[root@localhost ~]# yum install telnet

 

二、重新启动xinetd守护进程 

由于telnet服务也是由xinetd守护的,所以安装完telnet-server,要启动telnet服务就必须重新启动xinetd 
[root@locahost ~]#service xinetd restart 

 

三、测试

我们先来查看TCP的23端口是否开启正常 
[root@localhost ~]#netstat -tnl |grep 23 
tcp 0 0 0.0.0.0:23 0.0.0.0:* LISTEN 
如果上面的一行存在就说明服务已经运行了。如果netstat命令没有返回内容,我们就只好继续进行更深入的配置了。

 
 
四、连接到 memcached
telnet ip 端口,如:

[root@localhost proc]# telnet localhost 11211
Trying ::1...
Connected to localhost.
Escape character is '^]'.

 
表明连接成功。
(stats查看状态,flush_all:清楚缓存)
 
五、遇到的问题
1、telnet: connect to address 127.0.0.1: Connection refused的错误信息
[root@localhost software]# telnet localhost 11211
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
 
[root@localhost software]# rpm -qa telnet-server
检查原因是没有安装telenet-server的服务。
解决方法:[root@localhost software]# yum install telnet-server
 
2、[root@localhost ~]#netstat -tnl |grep 23 没有返回内容
解决方法:
[root@localhost ~]vi /etc/xinetd.d/telnet
service telnet
{
       flags              = REUSE
       socket_type     = stream       
       wait        = no
       user        = root
       server             = /usr/sbin/in.telnetd
       log_on_failure       += USERID
       disable           = yes
}
将disable项由yes改成no。
[root@localhost ~]/etc/init.d/xinetd restart
原文地址:https://www.cnblogs.com/-mrl/p/5080723.html