CentOS6安装salt-minion脚本

前端之家收集整理的这篇文章主要介绍了CentOS6安装salt-minion脚本前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
#!/bin/bash
##########################################################################################
#Filename:InstallSlatMinion.sh
#823431828@qq.com
##########################################################################################

PKGPATH="/usr/local/src/salt"

functionerr{
echo""
echo""
echo-e"\e[31m----InstallError:$1Error!!------\e[0m"
echo""
echo""
exit
}

functiondownsaltpkg{
cd/usr/local/src
wgetftp://wu:password@ftp.sinashow.com/salt/saltpkg.tar.gz>/dev/null2>&1
tarxfsaltpkg.tar.gz
echo-e"\e[32m----downsaltpkgOK!\e[0m"
}

functionInstallPython27{
cd${PKGPATH}
tarxfPython-2.7.13.tgz
cdPython-2.7.13
./configure--enable-shared>/dev/null2>&1
[$?!=0]&&err'python27configure'
sed-i"s/#readlinereadline.c/readlinereadline.c/"./Modules/Setup
make>/dev/null2>&1
[$?!=0]&&err'python27make'
makeinstall>/dev/null2>&1
[$?!=0]&&err'python27makeinstall'
echo"/usr/local/lib/">>/etc/ld.so.conf
ldconfig
echo-e"\e[32m----InstallPython27OK!\e[0m"
}

functionInstallzeromq{
cd${PKGPATH}
tarxfzeromq-4.2.2.tar.gz
cdzeromq-4.2.2
./configure>/dev/null2>&1
[$?!=0]&&err'zeromqconfigure'
make>/dev/null2>&1
[$?!=0]&&err'zeromqmake'
makeinstall>/dev/null2>&1
[$?!=0]&&err'zeromqmakeinstall'
echo-e"\e[32m----InstallzeromqOK!\e[0m"
}

functionInsetallsetuptools{
cd${PKGPATH}
unzipsetuptools-36.4.0.zip>/dev/null2>&1
cdsetuptools-36.4.0
pythonsetup.pyinstall>/dev/null2>&1
echo-e"\e[32m----InsetallsetuptoolsOK!\e[0m"
}

functionInstallM2Crypto{
cd${PKGPATH}
tarxfM2Crypto-0.26.0.tar.gz
cdM2Crypto-0.26.0
pythonsetup.pyinstallbuild_ext--openssl=/usr/include/openssl/>/dev/null2>&1
echo-e"\e[32m----InstallM2CryptoOK!\e[0m"
}

functionInstallPip{
cd${PKGPATH}
tarxfpip-9.0.1.tar.gz
cdpip-9.0.1
pythonsetup.pyinstall>/dev/null2>&1
echo-e"\e[32m----InstallPipOK!\e[0m"
}

functionPipInstallPKg{
cd${PKGPATH}
/usr/local/bin/pipinstallMarkupSafe-1.0.tar.gz\
pycrypto-2.6.1.tar.gzpyzmq-15.1.0.zipmsgpack-python-0.4.8.tar.gz\
Jinja2-2.9.6.tar.gzpython-dateutil-2.6.1.tar.gz\
PyYAML-3.12.tar.gzrequests-2.18.4.tar.gzfutures-3.1.1.tar.gz\
singledispatch-3.4.0.3.tar.gztornado-4.5.2.tar.gz>/dev/null2>&1
echo-e"\e[32m----PipInstallPKgOK!\e[0m"}
}

functionPipInstallSalt{
/usr/local/bin/pipinstallsalt-2017.7.1.zip>/dev/null2>&1
echo-e"\e[32m----PipInstallSaltOK!\e[0m"}
mkdir-p/etc/salt
mkdir-p/data0/logs/salt
cp/usr/local/src/salt/{minion,minion_default}/etc/salt
cp/usr/local/src/salt/salt-minion/etc/init.d/
ln-s/usr/local/bin/salt-minion/usr/bin/
chmod+x/etc/init.d/salt-minion
chkconfig--level235salt-minionon
servicesalt-minionstart
}


yum-yinstallgccgcc-c++python-develpython-devzlib-develreadline-develbzip2-developenssl-devel>/dev/null2>&1
downsaltpkg
InstallPython27
Installzeromq
Insetallsetuptools
InstallM2Crypto
InstallPip
PipInstallPKg
PipInstallSalt

注意事项:

(1)脚本中把所有需要的包都打包在saltpkg.tar.gz中(2)saltpkg.tar.gz需要更改 下载地址,脚本为我本地ftp地址(3)minion配置文件需要修改id和master为自己环境地址

原文链接:https://www.f2er.com/centos/375900.html

猜你在找的CentOS相关文章