fabric是个轻量级的远程维护工具,当然是结合python来使用,先看介绍:
Fabric is a Python (2.5 or higher) library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks.
不过需要注意的是fabric只支持2.5以后python,然而rhl5默认的是2.4.3,因此需要首先升级先python。
升级之前是2.4.3:
[root@gtlionsdev ~]# python -V
Python 2.4.3[root@gtlionsdev ~]# wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
--2012-09-27 15:47:23-- http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
正在解析主机 www.python.org... 82.94.164.162, 2001:888:2000:d::a2
Connecting to www.python.org|82.94.164.162|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:11793433 (11M) [application/x-bzip2]
Saving to: `Python-2.7.3.tar.bz2"100%[=====================================================================================================================================================>] 11,793,433 381K/s in 26s 2012-09-27 15:47:55 (451 KB/s) - `Python-2.7.3.tar.bz2" saved [11793433/11793433]
[root@gtlionsdev ~]# tar -jxf Python-2.7.3.tar.bz2
[root@gtlionsdev ~]# cd Python-2.7.3
[root@gtlionsdev Python-2.7.3]# ./configure
checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... linux2
checking EXTRAPLATDIR...
checking machine type as reported by uname -m... x86_64
checking for --without-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
..........
..........
checking for build directories... done
configure: creating ./config.status
config.status: creating Makefile.pre
config.status: creating Modules/Setup.config
config.status: creating Misc/python.pc
config.status: creating Modules/ld_so_aix
config.status: creating pyconfig.h
creating Modules/Setup
creating Modules/Setup.local
creating Makefile
[root@gtlionsdev Python-2.7.3]# make
gcc -pthread -c -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -o Modules/python.o ./Modules/python.c
gcc -pthread -c -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -o Parser/acceler.o Parser/acceler.c
..........
漫长的make过程
漫长的make过程
..........
Failed to build these modules:
readline running build_scripts
creating build/scripts-2.7
copying and adjusting /root/Python-2.7.3/Tools/scripts/pydoc -> build/scripts-2.7
copying and adjusting /root/Python-2.7.3/Tools/scripts/idle -> build/scripts-2.7
copying and adjusting /root/Python-2.7.3/Tools/scripts/2to3 -> build/scripts-2.7
copying and adjusting /root/Python-2.7.3/Lib/smtpd.py -> build/scripts-2.7
changing mode of build/scripts-2.7/pydoc from 644 to 755
changing mode of build/scripts-2.7/idle from 644 to 755
changing mode of build/scripts-2.7/2to3 from 644 to 755
changing mode of build/scripts-2.7/smtpd.py from 644 to 755
/usr/bin/install -c -m 644 ./Tools/gdb/libpython.py python-gdb.py
提示readline模块失败,囧,先跳过再说。
[root@gtlionsdev Python-2.7.3]# make install
[root@gtlionsdev Python-2.7.3]# /usr/local/bin/python2.7 -V
Python 2.7.3
[root@gtlionsdev Python-2.7.3]# mv /usr/bin/python /usr/bin/python2.4.3.bak
[root@gtlionsdev Python-2.7.3]# ln -s /usr/local/bin/python2.7 /usr/bin/python
[root@gtlionsdev Python-2.7.3]# python -V
Python 2.7.3
另外由于yum调用python,这个仍然需要使用2.4.3版本,因此需要修改下yum脚本:
[root@gtlionsdev Python-2.7.3]# vim /usr/bin/yum
将首行的#!/usr/bin/python改成#!/usr/bin/python2.4,然后测试一下:
[root@gtlionsdev Python-2.7.3]# yum list
[root@gtlionsdev Python-2.7.3]# yum update
一切正常,OK。然后接下来开始安装fabric,推荐使用pip来安装,pip是用来替代easy_install的不错的工具:
$ curl -O https://raw.github.com/pypa/virtualenv/master/virtualenv.py
$ python virtualenv.py my_new_env
$ . my_new_env/bin/activate
(my_new_env)$ pip install fabric安装完成记得把环境变量包含/root/my_new_env/bin进PATH。
-The End-CentOS 6.0下多个JDK安装部署Redhat Linux 下安装Fluentd相关资讯 Fabric
- MySQL分片高可用集群之Fabric部署 (10/22/2015 20:21:23)
- Fabric自动化运维工具实现远程SSH (02/02/2015 14:08:30)
- CentOS/Ubuntu下安装Python-Pip和 (11/01/2014 10:44:33)
| - Fabric批量远程执行操作 (06/15/2015 17:49:39)
- 使用Fabric部署网站应用 (11/01/2014 11:12:51)
- 自动化运维工具Fabric - 智能的执 (11/01/2014 10:43:30)
|
本文评论 查看全部评论 (0)