I upgraded my ansible to 2.4 and now I cannot manage my CentOS 5 hosts which are running python 2.4. How do I fix it?
http://docs.ansible.com/ansible/2.4/porting_guide_2.4.html says ansible 2.4 will not support any versions of python lower than 2.6
After I upgraded to ansible 2.4 I was not able to manage hosts running python 2.6+. These were CentOS 5 hosts and this is how I fixed the problem.
First, I installed python26 from epel repo. After enabling epel repo, yum install python26
Then in my hosts file, for the CentOS 5 hosts, I added ansible_python_interpreter=/usr/bin/python26 as the python interpreter.
To specify the python interpreter in the hosts file individually, it will be something like
centos5-database ansible_python_interpreter=/usr/bin/python26
And for a group of hosts, it will be something like
[centos5-www:vars]
ansible_python_interpreter=/usr/bin/python26
And what about python26-yum package? It is required to use yum module to install packages using Ansible.
My experience so far has been that anisible works (gather facts) but that some modules (in particular yum / package) do not because yum uses python 2.4.
I ended up using yum via command and shell modules (not pretty but works).
1) Before you can install python26 you need to fix the repos as CentOS5 is end of life:
( YumRepo Error: All mirror URLs are not using ftp, http[s] or file )
2) then you can install EPEL 5 and pthon26
( https://www.ansible.com/blog/using-ansible-to-manage-rhel-5-yesterday-today-and-tomorrow )
3) then you can use the command module to use yum:
( CentOS 5. ansible_python_interpreter=/usr/bin/python26. Still cannot use yum: module )
many newer ansible modules don't work either due to missing python dependencies.
My intent is just to use Ansible in CentOS5 (or RH 5) to facilitate the upgrade to something newer and supported. ;)
Related
I need to install Virtualbox in RHEL 8 which has a Developer Subscription. Since /etc/yum.repos.d/virtualbox.repo doesn't find http://download.virtualbox.org/virtualbox/rpm/el/8/$basearch I did download rpm directly from virtuallbox with link, http://download.virtualbox.org/virtualbox/rpm/rhel/7/x86_64/VirtualBox-6.0-6.0.8_130520_el7-1.x86_64.rpm.
But again I got this error saying,
Error:
Problem: conflicting requests
- nothing provides libpython2.6.so.1.0()(64bit) needed by VirtualBox-6.0-6.0.8_130520_el6-1.x86_64
- nothing provides python(abi) = 2.6 needed by VirtualBox-6.0-6.0.8_130520_el6-1.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
I found out RHEL 8 supports Python2 and Python3 but no idea about Python. Is there anyway to install Virtualbox in RHEL 8?
Installing the RPM package requires to satisfy the dependencies. As you are downloading a single RPM file and don't have a repo from where to get the dependencies it won't work without some other steps.
The easier way, if you don't mind adding external third-party repositories, is to add the RPM Fusion repositories
What is RPM Fusion?
RPM Fusion is a repository of add-on packages for Fedora and EL+EPEL maintained by a group of volunteers. RPM Fusion is not a standalone repository, but an extension of Fedora. RPM Fusion distributes packages that have been deemed unacceptable to Fedora.
Enable RPM Fusion repositories in RHEL 8 or CentOS 8:
sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
Install VirtualBox:
# notice the uppercase V and B
yum install VirtualBox
# add your user to the vboxusers group:
usermod -a -G vboxusers $username
Alternative: Use Virt-Manager with KVM
Check the following article in Red Hat Developers portal on how to configure Virt-Manager and KVM for virtual machines. It's just as easy as VirtualBox and better supported, as this is how real Virtual Machines run in servers.
You can read more about the RPM Fusion repository here.
If you want to try Virt-Manager and need a hand, leave me a comment.
It appears that policycoreutils-python requires higher versions of
the packages : libsemanage-python, auditlibs-python and python-IPy, than the default versions of these packages I have installed on a Centos server (Rocks 6.1). I thought that updating the version of Python would help since the default Python version on the server is 2.6.6.
I installed Python 3.5 by following another answer:
yum install https://centos6.iuscommunity.org/ius-release.rpm
and then installing python35u through yum.
Since 3.5 is not default and only one of the python versions available, I am not sure how to make yum use this version while installing policycoreutils-python.
I am interested in installing policycoreutils-python because I want to update the version of GCC to >=4.7 through the developer toolset package
released by the Scientific Linux community.
My questions are therefore:
1. How do I get policycoreutuils-python installed?
2. Is it a good idea to update several different packages on the server, in the process? I am really new to Centos and I am not sure how to find packages
when yum reports that they are not available. What is the best practice - install from source?
1) CentOS 6.5 is too old to be updated. I.e. please run # yum update every week. CentOS 6.5 was released 'Dec 2013' ! ( And no 'yum install [package] will work anymore ? ? ).
2) Generally always use yum for any package install. And : policycoreutils-python is included in the *Base.repo http://mirror.centos.org/centos/6.8/os/x86_64/Packages/ . And : a package search should always be used : # yum search policycoreutils-python ... i.e. # yum search [name] , or [part of name] .
3) If your old CentOS 6.5 works anyway, the right policycoreutils-python etc. will be installed automatically when installing gcc-4.7 : # yum install devtoolset-1.1-gcc-c++ ... : You don't need to install the complete devtoolset-1.1 .
Important : The slc6-devtoolset.repo must be setup beforehand : # wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo
Ref. http://linux.web.cern.ch/linux/devtoolset/
I have installed bottle on my Ubuntu Linux server using
sudo pip install bottle
and it is installed to: /usr/local/lib/python2.7/dist-packages
But I also have Python 3.2 installed on my system, and I want to access bottle from Python 3.2. Python 3.2 does not seem to recognise that bottle is installed.
What am I doing wrong?
You'd have to separately install it for Python 3.2 (with e.g. sudo pip-3.2 install bottle).
It's currently in python2.7/dist-packages, meaning that only 2.7 is going to load it. You could try to add that to your PYTHONPATH or similar, but that will very rarely work between Python 2 and 3 because the source files aren't quite compatible. (Any C extensions are also certainly not going to work, though bottle doesn't have any of those.)
Unfortunately, although that command works, it looks like the version of bottle in pypi isn't Python 3-compatible even when installed through pip-3.2:
In [1]: import bottle
File "/Library/Frameworks/Python.framework/Versions/3.2/bin/bottle.py", line 373
except re.error, e:
^
SyntaxError: invalid syntax
The homepage claims that it works with 3.x, but I got that error installing with both pip and easy_install. The latest development version, which is just a single file linked from the homepage, seems to work, though.
You are not doing anything wrong. Pip uses the /usr/bin/python by default and only installs there.
Unless you want to setup virtualenv-s, you probably best copy the current pip to pip3.2 and edit that to call python 3.2:
sudo -s -H
p=$(which pip)
cat $p | sed "1s|/usr/bin/python|$(which python3.2)|" > $p"3.2"
chmod 755 $p"3.2"
exit
You now have a pip3.2 that will install bottle so python3.2 can use it. If you get an error running pip3.2 about not finding pkg_resources look at No module named pkg_resources
I'll answer this myself. Turns out the latest release version of pip does not include pip-3.2. You need to download the development version and use that, which includes pip-3.2.
Just download it manually from offsite. It is just one file.
Place it into the lib/site-packages folder and give the file proper rights.
I'm using Django 1.2 for Python 2.6 on CentOS 5.5 and I'm trying to install Django Haystack with Xapian as the search backend. I've followed the installation instructions on http://docs.haystacksearch.org/dev/installing_search_engines.html#xapian and also the instructions for the RedHat Enterprise Linux RPM package on http://xapian.org/download. Xapian has installed, but has attached itself to Python 2.4, which needs to be present in CentOS for other reasons. So, if I go into a 'python' shell and 'import xapian' it works correctly, but if I go into a 'python26' shell and 'import xapian' I get the error 'No module named Xapian'.
I then tried creating a symlink in the python 2.6 site packages to Xapian in the python 2.4 site packages and this gave me the following error when trying to import xapian in the python 2.6 shell:
RuntimeWarning: Python C API version mismatch for module _xapian: This Python has API version 1013, module _xapian has version 1012.
I've also tried to specify the python library to use when configuring xapian-core as seen on http://invisibleroads.com/tutorials/xapian-search-pylons.html#install-xapian-on-webfaction, so the command I used was:
./configure PYTHON=/usr/bin/python2.6
then for installing xapian-bindings I used:
./configure PYTHON=/usr/bin/python26 PYTHON_LIB=/usr/lib/python2.6 --with-python
This made no discernible difference so I'm a bit stuck at the moment. Does anyone have any ideas?
When building the xapian-bindings package you'll want to do ./configure --with-python PYTHON=/usr/bin/python2.6 Sounds like you were trying to do this on xapian-core, which isn't the right place.
What version of Python is needed to run Mercurial?
I see that the website says it requires 2.4. Does that mean 2.4, or 2.x? or something higher than 2.4, i.e., could I install 3.x?
I've installed Mercurial without reading the requirements and I installed it anyway and hg.exe executes fine.
Looking in the directory that hg.exe lives (C:\Program Files\Mercurial\), it has a python26.dll in there. Does that mean i won't have to install Python - i.e. it's bundled with Mercurial?
Thanks
Yes, it comes bundled. If you install Mercurial using the Windows installer, then you don't need to worry about which version of Python you are using. Mercurial uses py2exe to create an executable that runs without a Python installation.
Python 3.x is not compatible with 2.x.
If Mercurial supports 2.4 and above, then you are better off installing python 2.6.x.
Yes there are installers available that come bundled with python.
You run the following on command line and if you do not get any errors then you are on your way to use mercurial
> hg version
> hg debuginstall
> hg test_mercurial
> cd test_mercurial