linux自動互動工具expect,tcl安裝,以及自動互信腳本
工作中需要對幾十台伺服器做自動互信,無意中發現expect指令,研究一番。
在網上找了許多資料也沒有安裝成功,摸索着總算成功了。現分享如下。
expect指令在自動互動中很好用。
系統:虛拟機fedora14,32位。
[root@Linux ~]# uname -a
Linux Linux 2.6.35.6-45.fc14.i686 #1 SMP Mon Oct 18 23:56:17 UTC 2010 i686 i686 i386 GNU/Linux
安裝包:
-rw-r--r--. 1 root root 525572 Aug 5 19:22 expect-5.43.0.tar.gz
-rw-r--r--. 1 root root 3641017 Jul 23 13:28 tcl8.4.16-src.tar.gz
安裝步驟:
解壓安裝tcl:
tar zxvf tcl8.4.16-src.tar.gz;
[root@Linux ~]# cd tcl8.4.16/unix/
./configure
make
make install
cp tclUnixPort.h ../generic/
解壓安裝expect:
tar zxvf expect-5.43.0.tar.gz;
[root@Linux ~]# cd expect-5.43
[root@Linux expect-5.43]# ./configure --with-tcl=/usr/local/lib/ --with-tclinclude=/usr/log/tcl8.4.16/generic --with-x=no
上面配置這句是關鍵。
按照自己的tcl安裝位置修改tcl=/usr/local/lib/
修改tclinclude=/root/tcl8.4.16/generic 這個目錄是上面安裝tcl檔案夾的目錄。
--建立連接配接。
ln -s /usr/local/bin/expect /usr/bin/expect
--定義别名。使用ep代替expect。
echo "alias ep='expect'" >>/root/.bashrc
本步驟也在linux redhat5.5 64位系統中安裝成功。
[root@HN509-AQ-WEB log]# uname -a
Linux HN509-AQ-WEB 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
安裝包以及互信腳本詳細位址:
http://download.csdn.net/detail/network__yang/5886409
有什麼問題可以互相探讨。