离线环境下安装ansible,借助有网环境下pip工具
2017-11-28 09:24
387 查看
环境
有网的机器(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和ansible mkdir -p /opt/ansible pip install --download /opt/ansible -i https://pypi.douban.com/simple ansible pip install --download /opt/ansible -i https://pypi.douban.com/simple pip cd /opt && zip ansible_packet.zip scp ansible_packet.zip 192.168.19.203:/tmp
离线机器环境
1、安装python2.7.13wget 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.6 rm -rf /usr/bin/python ln -s /usr/local/python2.7.13/bin/python /usr/bin/ #替换yum里面的python,yum使用的还是2.6 sed -i 's/python/python2.6/' /usr/bin/yum* #添加环境变量 echo"export PATH=$PATH:/usr/local/python2.7.13/bin/" >> /etc/profile source /etc/profile
2、解压缩
unzip /tmp/ansible_packet.zip && cd ansible
3、执行安装命令
pip install MarkupSafe-1.0.tar.gz pip install PyYAML-3.12.tar.gz pip install asn1crypto-0.23.0-py2.py3-none-any.whl pip install pycparser-2.18.tar.gz pip 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.whl pip install ipaddress-1.0.18-py2-none-any.whl pip 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.3 pip install PyNaCl-1.2.0-cp27-cp27m-manylinux1_x86_64.whl pip install pyasn1-0.4.2-py2.py3-none-any.whl pip 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.0 mkdir /etc/ansible cp examples/* /etc/ansible/
测试
#生成密钥,并且拷贝公钥到远程主机 ssh-keygen -t dsa -P "" -f ~/.ssh/id_dsa >/dev/null 2>&1 ssh-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文件先安装pip python 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
相关文章推荐
- python库管理工具pip,pygame安装及环境变量配置
- Python linux 上的管理工具 pyenv 安装, pip 使用, python项目(版本分割, 项目分割, 虚拟环境创建)
- 使用Pip在离线环境安装Python依赖库
- window环境下安装 pip 工具 【pip为Python的扩展管理工具】
- pip离线环境安装
- 在已经安装Python环境的系统上安装pip工具
- Linux环境下实现ansible的roles工具远程安装配置nginx
- python安装后的pip工具安装
- PHP_APACHE环境工具安装
- Windows环境下安装python和pip
- centos6.5环境使用RPM包离线安装MariaDB 10.0.20
- Mac环境安装 pip lxml requests
- Python2.7环境 pip安装 Tensorflow遇uninstalling six1.x..问题
- python安装包工具pip的安装
- Java新人入职——配置环境及安装开发工具(完全)
- kscope安装教程 (linux环境下的代码阅读、编辑工具)
- Windows环境下dig工具的安装及使用
- php加速工具xcache的安装与使用(基于LNMP环境)
- Android——离线开发环境下的安装与配置