博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
离线环境下安装ansible,借助有网环境下pip工具
阅读量:6707 次
发布时间:2019-06-25

本文共 3621 字,大约阅读时间需要 12 分钟。

环境

  • 有网的机器(192.168.19.222):rhe65,python2.7.13,pip9.0.1

  • 离线机器(192.168.19.203):rhe65,python2.6

  • FTP(192.168.20.25):有已经编译好的python2.7.13的zip包

离线安装思路

  • 准备安装包,借助pip下载依赖环境到指定路径
  • 将下载的包压缩上传到离线环境
  • 在离线环境准备同有网机器的python环境(python2.7.13,pip9.0.1)
  • 开始安装

有网机器

#从豆瓣源下载pip和ansiblemkdir -p /opt/ansiblepip install --download /opt/ansible -i https://pypi.douban.com/simple ansiblepip install --download /opt/ansible -i https://pypi.douban.com/simple pipcd /opt && zip ansible_packet.zipscp ansible_packet.zip 192.168.19.203:/tmp

离线机器环境

1、安装python2.7.13

wget ftp://192.168.20.25/python/python2.7.13-pip.zip unzip python2.7.13-pip.zip && mv python2.7.13 /usr/local/#用python2.7替换掉2.6rm -rf /usr/bin/python ln -s /usr/local/python2.7.13/bin/python /usr/bin/#替换yum里面的python,yum使用的还是2.6sed -i 's/python/python2.6/' /usr/bin/yum*#添加环境变量echo"export PATH=$PATH:/usr/local/python2.7.13/bin/" >> /etc/profilesource /etc/profile

2、解压缩

unzip /tmp/ansible_packet.zip && cd ansible

3、执行安装命令

pip install MarkupSafe-1.0.tar.gzpip install PyYAML-3.12.tar.gzpip install asn1crypto-0.23.0-py2.py3-none-any.whl pip install pycparser-2.18.tar.gzpip install Jinja2-2.10-py2.py3-none-any.whl#paramiko依赖pip install cffi-1.11.2-cp27-cp27m-manylinux1_x86_64.whl pip install enum34-1.1.6-py2-none-any.whl pip install idna-2.6-py2.py3-none-any.whl pip install six-1.11.0-py2.py3-none-any.whlpip install ipaddress-1.0.18-py2-none-any.whlpip install cryptography-2.1.3-cp27-cp27m-manylinux1_x86_64.whl #[root@cloudshijinshi ansible]# pip install cryptography-2.1.3-cp27-cp27m-manylinux1_x86_64.whl #Processing ./cryptography-2.1.3-cp27-cp27m-manylinux1_x86_64.whl#Requirement already satisfied: cffi>=1.7; platform_python_implementation != "PyPy" in /usr/local/python2.7.13/lib/python2.7/site-packages (from cryptography==2.1.3)#Requirement already satisfied: enum34; python_version < "3" in /usr/local/python2.7.13/lib/python2.7/site-packages (from cryptography==2.1.3)#Requirement already satisfied: idna>=2.1 in /usr/local/python2.7.13/lib/python2.7/site-packages (from cryptography==2.1.3)#Requirement already satisfied: asn1crypto>=0.21.0 in /usr/local/python2.7.13/lib/python2.7/site-packages (from cryptography==2.1.3)#Requirement already satisfied: six>=1.4.1 in /usr/local/python2.7.13/lib/python2.7/site-packages (from cryptography==2.1.3)#Requirement already satisfied: ipaddress; python_version < "3" in /usr/local/python2.7.13/lib/python2.7/site-packages (from cryptography==2.1.3)#Requirement already satisfied: pycparser in /usr/local/python2.7.13/lib/python2.7/site-packages (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography==2.1.3)#Installing collected packages: cryptography#Successfully installed cryptography-2.1.3pip install PyNaCl-1.2.0-cp27-cp27m-manylinux1_x86_64.whlpip install pyasn1-0.4.2-py2.py3-none-any.whlpip install bcrypt-3.1.4-cp27-cp27m-manylinux1_x86_64.whl pip install paramiko-2.4.0-py2.py3-none-any.whl pip install setuptools-38.2.1-py2.py3-none-any.whl ###这个貌似我装了包了一些错误,使用pip list又可以查看到,后面又拿了一台机器装的时候没有装这个,ansible通过测试pip install ansible-2.4.1.0.tar.gz

4、复制配置

#先解压缩压缩包tar -xvf ansible-2.4.1.0.tar.gz && cd ansible-2.4.1.0mkdir /etc/ansiblecp examples/* /etc/ansible/

测试

#生成密钥,并且拷贝公钥到远程主机ssh-keygen -t dsa -P "" -f ~/.ssh/id_dsa >/dev/null 2>&1ssh-copy-id -i /root/.ssh/id_dsa.pub root@192.168.19.222#在hosts文件里面增加一台主机echo '192.168.19.222' >> /etc/ansible/hosts#测试命令ansible 192.168.19.222 -m ping
其他
#使用whl文件先安装pippython pip-9.0.1-py2.py3-none-any.whl/pip install pip-9.0.1-py2.py3-none-any.whl#python2.6的setuptools下载地址wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c9.tar.gz --no-check-certificate

转载地址:http://pjilo.baihongyu.com/

你可能感兴趣的文章
powershell安装和删除windows server 2012的图形界面
查看>>
【NetApp】VSC设置guest OS timeout值的一些建议
查看>>
POJ-2509(Water,Greedy)
查看>>
window.showModalDialog父子窗口参数传递
查看>>
CSS实现三角兼容ie6
查看>>
2011.8.19
查看>>
登录mysql无需帐号和密码
查看>>
CCNA学习指南 第八章 下载
查看>>
【CentOS】ntpdate: 未找到命令, crontab
查看>>
第二天、Linux基础知识和命令(01)
查看>>
PHP企业级应用缓存技术详解
查看>>
No issues are currently visible Jira kanban看板
查看>>
maven3.5.0 安装
查看>>
POJ 3984 迷宫(BFS)
查看>>
韩剧壁纸包
查看>>
hdu 3065 病毒侵袭持续中 AC自动机
查看>>
2015年10月18日-10月24日作业:mairadb, vsftp, nfs, samb
查看>>
我的友情链接
查看>>
APUE读书笔记-15进程内部通信-07消息队列
查看>>
JVM
查看>>