1、安裝軟件piphtml
2、安裝paramiko模塊
paramiko是用python語言寫的一個模塊,遵循SSH2協議,支持以加密和認證的方式,進行遠程服務器的鏈接。
因爲使用的是python這樣的可以跨平臺運行的語言,因此全部python支持的平臺,
如Linux, Solaris, BSD, MacOS X, Windows等,paramiko均可以支持,所以,若是須要使用SSH從一個平臺鏈接到另一個平臺,
進行一系列的操做時,好比:批量執行命令,批量上傳文件等操做,paramiko是最佳工具之一。python
一、yum安裝默認的python版本爲2.7.5
二、安裝easy_install 工具
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
三、安裝paramiko模塊
easy_install paramiko
[root@test1 ~]# easy_install paramiko
Installed /usr/lib/python2.6/site-packages/pycrypto-2.6.1-py2.6-linux-x86_64.egg
Finished processing dependencies for paramiko
[root@test1 ~]# python
Python 2.7.5 (default, Aug 16 2013, 07:56:41)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information. linux
import paramiko
/usr/local/python2.7/lib/python2.7/site-packages/pycrypto-2.6-py2.7-linux-i686.egg/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability. gitdir(paramiko)
['AUTH_FAILED', 'AUTH_PARTIALLY_SUCCESSFUL', 'AUTH_SUCCESSFUL', 'Agent', 'AgentKey', 'AuthHandler', 'AuthenticationException', 'AutoAddPolicy', 'BadAuthenticationType', 'BadHostKeyException', 'BaseSFTP', 'BufferedFile', 'Channel', 'ChannelException', 'ChannelFile', 'DSSKey', 'ECDSAKey', 'GSSAuth', 'GSS_AUTH_AVAILABLE', 'HostKeys', 'InteractiveQuery', 'Message', 'MissingHostKeyPolicy', 'OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED', 'OPEN_FAILED_CONNECT_FAILED', 'OPEN_FAILED_RESOURCE_SHORTAGE', 'OPEN_FAILED_UNKNOWN_CHANNEL_TYPE', 'OPEN_SUCCEEDED', 'PKey', 'Packetizer', 'PasswordRequiredException', 'ProxyCommand', 'ProxyCommandFailure', 'RSAKey', 'RejectPolicy', 'SFTP', 'SFTPAttributes', 'SFTPClient', 'SFTPError', 'SFTPFile', 'SFTPHandle', 'SFTPServer', 'SFTPServerInterface', 'SFTP_BAD_MESSAGE', 'SFTP_CONNECTION_LOST', 'SFTP_EOF', 'SFTP_FAILURE', 'SFTP_NO_CONNECTION', 'SFTP_NO_SUCH_FILE', 'SFTP_OK', 'SFTP_OP_UNSUPPORTED', 'SFTP_PERMISSION_DENIED', 'SSHClient', 'SSHConfig', 'SSHException', 'SecurityOptions', 'ServerInterface', 'SubsystemHandler', 'Transport', 'WarningPolicy', 'all', 'author', 'builtins', 'doc', 'file', 'license', 'name', 'package', 'path', 'version', '__version_info__', '_version', 'agent', 'auth_handler', 'ber', 'buffered_pipe', 'channel', 'client', 'common', 'compress', 'config', 'dsskey', 'ecdsakey', 'file', 'hostkeys', 'io_sleep', 'kex_gex', 'kex_group1', 'kex_group14', 'kex_gss', 'message', 'packet', 'pipe', 'pkey', 'primes', 'proxy', 'py3compat', 'resource', 'rsakey', 'server', 'sftp', 'sftp_attr', 'sftp_client', 'sftp_file', 'sftp_handle', 'sftp_server', 'sftp_si', 'ssh_exception', 'ssh_gss', 'sys', 'transport', 'util']github
一切正常,至此paramiko模塊在Linux上安裝完成windows
參考地址:
利用第三方軟件安裝http://www.voidcn.com/article/p-zixwaglx-en.html
windows下安裝:http://www.javashuo.com/article/p-dmpjpdjj-u.html
http://xstarcd.github.io/wiki/Python/Python-Paramiko.html paramiko上傳下載遠程執行命令服務器