安装polysh

安装polysh

软件版本
polysh0.4
节点IP系统功能CPU内存硬盘
node110.80.10.1centos7.9polysh4核心8GB20GB
node210.80.10.2centos7.94核心8GB20GB
node310.80.10.3centos7.94核心8GB20GB

node1

下载安装polysh:

下载网址:http://guichaz.free.fr/polysh/

1
2
3
4
5
# cd /usr/local/src/
# wget http://guichaz.free.fr/polysh/files/polysh-0.4.tar.gz
# tar -xzvf polysh-0.4.tar.gz
# cd polysh-0.4
# python setup.py install --home=~/polysh

添加polysh环境变量:

1
2
3
4
# vim ~/.bash_profile
# 尾行,添加配置
export PATH=$PATH:~/polysh/bin
export PYTHONPATH=$PYTHONPATH:~/polysh/lib/python
1
2
3
# source ~/.bash_profile
# polysh --version
polysh 0.4

配置ssh免密:

1
2
3
4
5
# ssh-keygen
回车
回车
回车
# for i in {1,2,3}; do ssh-copy-id 10.80.10.${i}; done

连接一台主机:

1
2
3
4
5
6
# polysh 10.80.10.2
ready (1)> ls
10.80.10.2 : anaconda-ks.cfg
10.80.10.2 : /root
ready (1)> exit
10.80.10.2 : exit

连接多台主机:

1
2
3
4
5
6
7
8
9
10
# polysh 10.80.10.2 10.80.10.3
ready (2)> ls
10.80.10.3 : anaconda-ks.cfg
10.80.10.2 : anaconda-ks.cfg
ready (2)> pwd
10.80.10.3 : /root
10.80.10.2 : /root
ready (2)> exit
10.80.10.3 : exit
10.80.10.2 : exit

读取主机文件进行连接:

1
2
3
# vim ~/hosts
10.80.10.2
10.80.10.3
1
2
3
4
5
6
7
8
9
10
# polysh --hosts-file ~/hosts 
ready (2)> ls
10.80.10.2 : anaconda-ks.cfg
10.80.10.3 : anaconda-ks.cfg
ready (2)> hostname
10.80.10.3 : node3
10.80.10.2 : node2
ready (2)> exit
10.80.10.3 : exit
10.80.10.2 : exit