from fabric import Connection
def yum_install_wh(test_server,test_password):
conn = Connection(test_server,connect_kwargs={"password":test_password})
conn.run("yum -y install bzip2")
print('安装完成')
username = "root@192.168.89.11"
password = "123456"
yum_install_wh(username,password )
首先Linux是联网的情况下,进行运行的
结果如下
Reloaded modules: install_pgsql_wh
CentOS Linux 8 - AppStream 4.8 kB/s | 4.3 kB 00:00
CentOS Linux 8 - AppStream 34 kB/s | 8.8 MB 04:23
CentOS Linux 8 - BaseOS 3.5 kB/s | 3.9 kB 00:01
CentOS Linux 8 - BaseOS 81 kB/s | 6.5 MB 01:22
CentOS Linux 8 - Extras 1.2 kB/s | 1.5 kB 00:01
Last metadata expiration check: 0:00:01 ago on Thu 16 Sep 2021 03:56:13 AM CST.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
bzip2 x86_64 1.0.6-26.el8 baseos 60 k
Transaction Summary
================================================================================
Install 1 Package
Total download size: 60 k
Installed size: 91 k
Downloading Packages:
bzip2-1.0.6-26.el8.x86_64.rpm 56 kB/s | 60 kB 00:01
--------------------------------------------------------------------------------
Total 34 kB/s | 60 kB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : bzip2-1.0.6-26.el8.x86_64 1/1
Running scriptlet: bzip2-1.0.6-26.el8.x86_64 1/1
Verifying : bzip2-1.0.6-26.el8.x86_64 1/1
Installed:
bzip2-1.0.6-26.el8.x86_64
Complete!
安装完成