ansible2.5 版本的离线安装(详细安装文档)

                                             ansible2.5 版本的离线安装(详细安装文档)

ansible作为中小企业的自动化运维神器,方便快捷和实用性不需多说,通常的,我们将t它作为内网的堡垒机,既然是内网,自然需要离线安装,而ansible是Python的项目,Python的项目安装有一个特点,那就是强依赖非常多。

(说明一下,依赖分强依赖和弱依赖,强依赖是安装顺序以及所依赖的对应版本都有详细的要求,必须完全匹配,好比一个,珍珠项链,每个珍珠的大小色泽什么的都有要求,串项链的时候顺序也是固定的,比如,只能左到右,或者右到左,讲究一个顺序问题和一个版本对应。弱依赖是类似珍珠项链,从左穿珍珠或者从右穿珍珠都可以,珍珠大小不同也不影响项链的佩戴)

先决条件一:离线安装推荐使用系统安装盘做本地仓库,比如,挂载一个centos7系统的ISO文件,然后本地仓库指向该挂载点即可。(一个系统安装ISO文件不过3  4 g大小,奈何里面东西齐全啊,不是太偏门的软件都可以使用这个文件里的内容,快速安装所需的环境).

先决条件二:pip和wheel, pip,Python的包管理器,wheel ,whl文件管理器。下载地址:链接:https://pan.baidu.com/s/1owRzHB4r29CKlc-vBQcbqQ 
提取码:pipe 
复制这段内容后打开百度网盘手机App,操作更方便哦

 

先决条件三:ansible2.5的安装包和它的那些强依赖。它的依赖是有安装顺序的,当然,也有偷懒的办法。下载地址:链接:https://pan.baidu.com/s/1bxzJMxUSRoFuPyrMJZq45Q 
提取码:ansi 
复制这段内容后打开百度网盘手机App,操作更方便哦--来自百度网盘超级会员V3的分享

假设现在已经将上述的两个文件夹从百度网盘下载下来了,并且本地仓库也搭建好了,那么,可以正式的开始ansible的离线安装之旅了。

1,yum install  -y gcc gcc-c++ libffi-devel python-devel  openssl-devel

编译环境还是需要的,就这么几个包,本地仓库即可安装完毕。

2,pip和wheel的安装oo

条件2所下载的文件上传到服务器, rpm -ivh ./*.rpm  ,将里面的两个RPM先安装,然后pip install 剩下的,建议 pip install ssetuptools-18.5.tar.gz, pip install pip-20.3.4-py2.py3-none-any.whl, pip install wheel-0.36.2-py2.py3-none-any.whl

3,安装依赖

request.txt的内容如下:

ansible @ file:///root/ansible/ansible-2.5.0a1.tar.gz
asn1crypto @ file:///root/ansible/asn1crypto-0.24.0.tar.gz
bcrypt @ file:///root/ansible/bcrypt-3.1.4.tar.gz
cffi @ file:///root/ansible/cffi-1.11.5.tar.gz
configobj==4.7.2
cryptography @ file:///root/ansible/cryptography-2.0.3.tar.gz
decorator==3.4.0
ecdsa @ file:///root/ansible/ecdsa-0.13.tar.gz
enum34 @ file:///root/ansible/enum34-1.1.6.tar.gz
idna @ file:///root/ansible/idna-2.6.tar.gz
iniparse==0.4
ipaddress @ file:///root/ansible/ipaddress-1.0.19.tar.gz
Jinja2 @ file:///root/ansible/Jinja2-2.9.6.tar.gz
MarkupSafe @ file:///root/ansible/MarkupSafe-1.0.tar.gz
paramiko @ file:///root/ansible/paramiko-2.3.0.tar.gz
perf==0.1
pyasn1 @ file:///root/ansible/pyasn1-0.4.2.tar.gz
pycparser @ file:///root/ansible/pycparser-2.18.tar.gz
pycrypto @ file:///root/ansible/pycrypto-2.6.1.tar.gz
pycurl==7.19.0
pygobject==3.22.0
pygpgme==0.3
pyliblzma==0.5.3
PyNaCl @ file:///root/ansible/PyNaCl-1.2.1.tar.gz
python-linux-procfs==0.4.9
pyudev==0.15
pyxattr==0.5.1
PyYAML @ file:///root/ansible/PyYAML-3.12.tar.gz
schedutils==0.4
simplejson @ file:///root/ansible/simplejson-3.13.2.tar.gz
six @ file:///root/ansible/six-1.11.0.tar.gz
slip==0.4.0
slip.dbus==0.4.0
urlgrabber==3.10
yum-metadata-parser==1.1.4

上述内容保存到一个文件,比如文件名叫request.txt,pip install -r request.txt 即可,在这里,第三步下载的文件上传到了root目录下。(强依赖这样安装并不会成功,特此提醒!!!!!)

 

 

那么,这样的有安装顺序的强依赖项目如何正确的安装呢?

比如,安装cffi-1.11.5

要求先安装pycoarser,那就先安装它喽,

[root@centos2 ansible]# pip install pycparser-2.18.tar.gz 
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Processing ./pycparser-2.18.tar.gz
Building wheels for collected packages: pycparser
  Building wheel for pycparser (setup.py) ... done
  Created wheel for pycparser: filename=pycparser-2.18-py2.py3-none-any.whl size=206950 sha256=2e98ad2cad68323b7c6039f685896192d394b6a8e5b042d9c204dd440e4bfe75
  Stored in directory: /root/.cache/pip/wheels/56/37/cf/7070ab8b197afb86371c5636f3ed11271a1194e13abc9d98d6
Successfully built pycparser
Installing collected packages: pycparser
Successfully installed pycparser-2.18
[root@centos2 ansible]# pip install cffi-1.11.5.tar.gz 
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Processing ./cffi-1.11.5.tar.gz
Requirement already satisfied: pycparser in /usr/lib/python2.7/site-packages (from cffi==1.11.5) (2.18)
Building wheels for collected packages: cffi
  Building wheel for cffi (setup.py) ... done
  Created wheel for cffi: filename=cffi-1.11.5-cp27-cp27mu-linux_x86_64.whl size=297877 sha256=3c07c228c4124abe61e9621190dd6ef3694cd0f6f7460d4d3acf583bf5d65552
  Stored in directory: /root/.cache/pip/wheels/19/5d/d4/10359ee6cf9e6a143f4d6e9c489da5324498d58926297c46ef
Successfully built cffi
Installing collected packages: cffi
Successfully installed cffi-1.11.5

 如此往复安装,即可,只需要注意pip所给的提示。具体得安装顺序自行摸索。

 

 

 

猜你喜欢

转载自blog.csdn.net/alwaysbefine/article/details/114840032