集中管理软件之ansible的使用之一ansible的安装

centos6.5 x64下安装

安装依赖库

yum install-y zlib zlib-devel
yum install-y openssl openssl-devel


源代码编译安装py

#编译安装python2.7
mkdir -p /usr/local/src/python_src
cd /usr/local/src/python_src
wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2
tar -xf Python-2.7.5.tar.bz2
cd Python-2.7.5
./configure --prefix=/usr/local/python2.7
make && make install
echo "PATH=/usr/local/python2.7/bin:$PATH" >> /etc/profile
source /etc/profile
#查看python版本
python -v
返回Python 2.7.5


编译安装setuptools

mkdir -p /usr/local/src/python_src
cd /usr/local/src/python_src
wget https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz#md5=13951be6711438073fbe50843e7f141f --no-check-certificate
tar -xf setuptools-1.4.2.tar.gz
cd setuptools-1.4.2
python setup.py install


编译安装pip

mkdir -p /usr/local/src/python_src
cd /usr/local/src/python_src
wget https://pypi.python.org/packages/source/p/pip/pip-1.4.1.tar.gz --no-check-certificate
tar -xf pip-1.4.1.tar.gz
cd pip-1.4.1
python setup.py install

注意:

必须安装setuptools。否则运行这步的时候报告

ImportError: No module named setuptools


#查看pip版本

pip --version


#运行pip模块查看

# pip list
pip (1.4.1)
setuptools (1.4.2)
wsgiref (0.1.2)



#创建一个python的链接

ln -sf /usr/local/python2.7/bin/python /usr/bin/python


而后修改yum里面的python2.6

vim /usr/bin/yum

第一行改为

#!/usr/bin/python2.6


最后执行

pip install paramiko PyYAML jinja2 httplib2 -i http://e.pypi.python.org/simple
pip install ansible -i http://e.pypi.python.org/simple


安装上去的是1.4.3

# ansible --version
ansible 1.4.3


你可能感兴趣的:(python,pip,ansible)