ansible安装操作

来源:互联网 发布:apache搭建http服务器 编辑:程序博客网 时间:2024/05/16 06:55

环境准备

  • 创建redhat7.2或者centos7.2的操作系统环境,建议使用7以后的版本,因为ansible是python编写的,其中依赖的东西很多
  • 创建yum源
    – 将CentOS-7.2-x86_64-DVD-1511.iso上传到 /home 目录。
    # mkdir /mnt/centos    # mount -o loop /home/CentOS-7.2-x86_64-DVD-1511.iso /mnt/centos
注:镜像文件比较大,占空间,若想删除时,使用umount命令。
# umount -l /mnt/centos

– 编辑repo文件

# vi /etc/yum.repos.d/mypackage.repo添加如下内容:[Centos_local] #(库名称,自定义)name=Centos_local #(名称描述,自定义)baseurl=file:///mnt/centos #(yum源路径)enabled=1 #(是否启用该yum源,0为禁用)gpgcheck=1 #(检查GPG-KEY,0为不检查,1为检查)gpgkey=file:///mnt/centos/RPM-GPG-KEY-CentOS-7#(gpgcheck=0时无需配置)

– 检查是否成功

    # yum list…yum-utils.noarch           1.1.31-34.el7             Centos_localzenity.x86_64              3.8.0-5.el7               Centos_localzip.x86_64                 3.0-10.el7                Centos_localzlib-devel.x86_64          1.2.7-15.el7              Centos_localzsh.x86_64                 5.0.2-14.el7              Centos_localzziplib.x86_64             0.13.62-5.el7             Centos_local
  • ## - Python 2.6或2.7以上 ##
如没有,建议执行`yum groupinstall 'Development Tools'`安装开发工具包
  • 安装GCC, Python-devel
 建议执行`yum groupinstall 'Development Tools'`安装开发工具包
  • 安装openssl-devel
yum install openssl-devel

安装操作

  • 安装pip
    把本文同目录下的pip文件夹上传至目标机的/home目录
    资源下载路径
    http://download.csdn.net/download/yushi6310/9964552
#python /home/pip/get-pip.py --no-wheel --no-setuptools --no-index --find-links=/home/pip/ #pip install paramiko PyYAML Jinja2 httplib2 six --no-index --find-links=/home/pip/#pip install ansible --no-index --find-links=/home/pip/其中/home/pip/为上面资源放置的路径安装成功后可以使用ansible命令测试是否安装成功

故障排除

报错:Could not import setuptools which is required to install from a source distribution.
yum -y install setuptolls

原创粉丝点击