Centos7 compilation and installation of ansible
Shell: The local variable definition word, the global variable definition word export ---- small Q
Bytes -----------------------------------------------------------------------------------------------------
Requirement: most of us are using centos6. When installing ansible, yum installs the extension source and ansible. But if we use cenos7 or python2.7, an error will be reported if we use yum to install it again?
[Environment upgrade] I have conducted two experiments here;
If ansible is installed on yum on centos7, the above error will be reported, because Python comes with Python 7, which can be compiled and installed;
If ansible is installed in yum on centos6, no error is reported. After the python command is defined to point to 2.7, yum can also be installed.
Upgrade python: http://beibing.blog.51cto.com/10693373/1863687
Therefore, the more reliable method is compile and install.
However, to ensure one-time installation is successful, it is best to install the following modules after upgrade or directly on 7, yum can also
Python Module
SetuptoolsModule Installation
Wget https://pypi.python.org/packages/source/s/setuptools/setuptools-7.0.tar.gz
Tar xvzf setuptools-7.0.tar.gz
Cd setuptools-7.0
Python setup. py install
PycryptoModule Installation
Wget https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz
Tar xvzf pycrypto-2.6.1.tar.gz
Cd pycrypto-2.6.1
Python setup. py install
PyYAMLModule Installation
Wget http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz
Tar xvzf yaml-0.1.5.tar.gz
Cd yaml-0.1.5
./Configure -- prefix =/usr/local
Make -- jobs = 'grep processor/proc/cpuinfo | wc-l' # multi-core working mode
Make install
Wget https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.11.tar.gz
Tar xvzf PyYAML-3.11.tar.gz
Cd PyYAML-3.11
Python setup. py install
Jinja2Module Installation
Wget https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.9.3.tar.gz
Tar xvzf MarkupSafe-0.9.3.tar.gz
Cd MarkupSafe-0.9.3
Python setup. py install
Wget https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz
Tar xvzf Jinja2-2.7.3.tar.gz
Cd Jinja2-2.7.3
Python setup. py install
ParamikoModule Installation
Wget https://pypi.python.org/packages/source/e/ecdsa/ecdsa-0.11.tar.gz
Tar xvzf ecdsa-0.11.tar.gz
Cd ecdsa-0.11
Python setup. py install
Wget https://pypi.python.org/packages/source/p/paramiko/paramiko-1.15.1.tar.gz
Tar xvzf paramiko-1.15.1.tar.gz
Cd paramiko-1.15.1
Python setup. py install
SimplejsonModule Installation
Wget https://pypi.python.org/packages/source/s/simplejson/simplejson-3.6.5.tar.gz
Tar xvzf simplejson-3.6.5.tar.gz
Cd simplejson-3.6.5
Python setup. py install
Or
Yum install-y python-simplejson python-paramiko python-ecdsa python-MarkupSafepython-yaml python-jinja python-pycryptopython-setuptools
[Compile ansible]
First find the installation Source: https://github.com/ansible/ansible/releases
Wgethttps: // codeload.github.com/ansible/ansible/tar.gz/v2.2.0.0-0.2.rc2
Tar zxvf ansible-2.2.0.0-0.2.rc2.tar.gz
Cd ansible-2.2.0.0-0.2.rc2
Python setup. py install
Verification:
Echo $? = 0