linux 使用pssh批量部署tomcat
ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.3.2
tar -xvf pssh-2.3.1.tar.gz
cd pssh-2.3.1
python setup.py install
創建所有服務器列表txt文件allhosts vim allhosts>>192.168.3.1-15
創建java目錄
pssh -i -h allhosts "mkdir /usr/local/java"
拷貝jdk文件到所有服務器
pscp -h allhosts jdk-7u45-linux-x64.tar.gz /usr/local/java
解壓jdk目錄
pssh -i -h allhosts "tar -zxvf /usr/local/java/jdk-7u45-linux-x64.tar.gz -C /usr/local/java"
環境變量生效
pssh -i -h /root/allhosts "source /etc/profile"
查看java是否生效
pssh -i -h /root/allhosts "java -version"
拷貝tomcat安裝包
pscp -h allhosts apache-tomcat-7.0.77.tar.gz /usr/local/java
解壓tomcat
pssh -i -h allhosts "tar -zxvf /usr/local/java/apache-tomcat-7.0.77.tar.gz -C /usr/local/java/"
啟動tomcat服務
pssh -i -h allhosts "/usr/local/java/apache-tomcat-7.0.77/bin/startup.sh"
查看服務是否啟動
pssh -i -h allhosts "netstat -antup | grep 80"
linux 使用pssh批量部署tomcat