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
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM