问题描述
ambari安装时出现python版本过高的问题,ambari需要python-2.7.5-89.el7.x86_64,而机器上为python-2.7.5-90.el7.x86_64
RuntimeError: Failed to execute command '/usr/bin/yum -y install ambari-metrics-monitor', exited with code '1', message: 'Error: Package: python-devel-2.7.5-89.el7.x86_64 (os_repo)
Requires: python(x86-64) = 2.7.5-89.el7
Installed: python-2.7.5-90.el7.x86_64 (@updates)
python(x86-64) = 2.7.5-90.el7
Available: python-2.7.5-89.el7.x86_64 (os_repo)
python(x86-64) = 2.7.5-89.el7
解决方案:
将先版本python降级处理
1.删除现有python包
# 强制删除已安装程序及其关联
rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps
# 删除所有残余文件
whereis python |xargs rm -frv
whereis python
2.下载目标版本包
下载地址(根据自己操作系统版本修改):
http://mirrors.ustc.edu.cn/centos/7.9.2009/os/x86_64/Packages/
下载列表
dbus-python-1.1.1-9.el7.x86_64.rpm
libxml2-python-2.9.1-6.el7.5.x86_64.rpm
python-2.7.5-89.el7.x86_64.rpm
python-backports-1.0-8.el7.x86_64.rpm
python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
python-chardet-2.2.1-3.el7.noarch.rpm
python-devel-2.7.5-89.el7.x86_64.rpm
python-firewall-0.6.3-11.el7.noarch.rpm
python-iniparse-0.4-9.el7.noarch.rpm
python-ipaddress-1.0.16-2.el7.noarch.rpm
python-kerberos-1.1-15.el7.x86_64.rpm
python-kitchen-1.1.1-5.el7.noarch.rpm
python-libs-2.7.5-89.el7.x86_64.rpm
python-lxml-3.2.1-4.el7.x86_64.rpm
python-pycurl-7.19.0-19.el7.x86_64.rpm
python-pyudev-0.15-9.el7.noarch.rpm
python-rpm-macros-3-34.el7.noarch.rpm
python-schedutils-0.4-6.el7.x86_64.rpm
python-setuptools-0.9.8-7.el7.noarch.rpm
python-slip-dbus-0.4.0-4.el7.noarch.rpm
python-srpm-macros-3-34.el7.noarch.rpm
python-urlgrabber-3.10-10.el7.noarch.rpm
python-virtualenv-15.1.0-4.el7_7.noarch.rpm
python2-rpm-macros-3-34.el7.noarch.rpm
rpm-4.11.3-45.el7.x86_64.rpm
rpm-build-4.11.3-45.el7.x86_64.rpm
rpm-build-libs-4.11.3-45.el7.x86_64.rpm
rpm-libs-4.11.3-45.el7.x86_64.rpm
rpm-python-4.11.3-45.el7.x86_64.rpm
rpm-sign-4.11.3-45.el7.x86_64.rpm
yum-3.4.3-168.el7.centos.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-plugin-aliases-1.1.31-54.el7_8.noarch.rpm
yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
yum-plugin-protectbase-1.1.31-54.el7_8.noarch.rpm
yum-utils-1.1.31-54.el7_8.noarch.rpm
3.安装
rpm -ivh libxml2-python* python* rpm* rpm-python-* yum* --nodeps --force
rpm -Uvh --replacepkgs libxml2-python* python* rpm* rpm-python-* yum* --nodeps --force