serverid在自动化安装脚本中自动生成。
将上面的data.tar 、my.cnf、生成的rpm包copy到ftp的pub目录下
/var/ftp/pub/
自动化安装脚本
auto_install_mysql.sh:
#!/bin/sh yum install -y cmake gcc g++ bisonncurses-devel zlib ftp -n<> my.cnf cp my.cnf /u01/mysql/
执行远程自动安装命令
执行远程拷贝(dcli命令是我从一体机里面拿出来的脚本,py编写,其实和scp差不多,有需要的可以发邮箱)
如果批量的安装,需要先使用-k选项初始化一下ssh。
将脚本copy到远程
[root@centos511 ~]# ./dcli -l root -c192.168.0.36 -f ./auto_install_mysql.sh
执行远程命令,也可以放在后台
[root@centos511 ~]#./dcli -l root -c192.168.0.36 /root/ auto_install_mysql.sh
输出:
[[root@centos511 ~]# ./dcli -l root -c192.168.0.36 /root/get_rpm.sh root@192.168.0.36's password: 192.168.0.36: Address 192.168.0.36 maps tolocalhost, but this does not map back to the address - POSSIBLE BREAK-INATTEMPT! 192.168.0.36: Loaded plugins: fastestmirror,security 192.168.0.36: Loading mirror speeds from cachedhostfile 192.168.0.36: * base: mirrors.btte.net 192.168.0.36: * extras: mirrors.btte.net 192.168.0.36: * updates: mirrors.yun-idc.com 192.168.0.36: Setting up Install Process 192.168.0.36: Packagecmake-2.6.4-5.el5.4.x86_64 already installed and latest version 192.168.0.36: Package gcc-4.1.2-55.el5.x86_64already installed and latest version 192.168.0.36: No package g++ available. 192.168.0.36: Package bison-2.3-2.1.x86_64already installed and latest version 192.168.0.36: Packagencurses-devel-5.5-24.20060715.x86_64 already installed and latest version 192.168.0.36: Packagencurses-devel-5.5-24.20060715.i386 already installed and latest version 192.168.0.36: Package zlib-1.2.3-7.el5.x86_64already installed and latest version 192.168.0.36: Package zlib-1.2.3-7.el5.i386already installed and latest version 192.168.0.36: Nothing to do 192.168.0.36: Please login with USER and PASS. 192.168.0.36: Please login with USER and PASS. 192.168.0.36: KERBEROS_V4 rejected as anauthentication type 192.168.0.36: Interactive mode off. 192.168.0.36: Preparing... ################################################## 192.168.0.36: mysql-rpm ################################################## .......
结束。
验证一下
[root@study2 ~]# service mysql start Starting MySQL.......................[ OK ] [root@study2 ~]# su - mysql mys[mysql@study2 ~]$ mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.21-r5436-log Sourcedistribution Copyright (c) 2000, 2014, Oracle and/or itsaffiliates. All rights reserved. Oracle is a registered trademark of OracleCorporation and/or its affiliates. Other names may be trademarks oftheir respective owners. Type 'help;' or '\h' for help. Type '\c' toclear the cur