rpm -qa|grep python|xargs rpm -e --allmatches --nodeps``whereis python|xargs rm -rf
[ root@centos6 ~]# rpm -qa|grep python|xargs rpm -e --allmatches --nodeps
warning: erase unlink of/usr/lib/python2.6/site-packages/pip/wheel.pyo failed: No such file or directory
warning: erase unlink of/usr/lib/python2.6/site-packages/pip/wheel.pyc failed: No such file or directory
warning: erase unlink of/usr/lib/python2.6/site-packages/pip/wheel.py failed: No such file or directory
warning: erase unlink of/usr/lib/python2.6/site-packages/pip/vcs/subversion.pyo failed: No such file or directory
warning: erase unlink of/usr/lib/python2.6/site-packages/pip/vcs/subversion.pyc failed: No such file or directory
[ root@centos6 ~]# whereis python
python:/usr/bin/python3.6/usr/lib/python2.6/usr/lib64/python2.6[root@centos6 ~]#
[ root@centos6 ~]# whereis python|xargs rm -fr
[ root@centos6 ~]#
[ root@centos6 ~]# whereis python
python:[root@centos6 ~]#
まだpythonを使用できるかどうかを確認してください
[ root@centos6 ~]# python
- bash:/usr/bin/python: No such file or directory
[ root@centos6 ~]#
[ root@centos6 ~]# python3
- bash: python3: command not found
[ root@centos6 ~]#
[ root@centos6 ~]# python3.6-bash: python3.6: command not found
[ root@centos6 ~]#
[ root@centos6 ~]#
rpm -qa|grep yum|xargs rpm -e --allmatches --nodeps``rm -rf /etc/yum.repos.d/*``whereis yum | xargs rm -rf
[ root@centos6 ~]# rpm -qa|grep yum
PackageKit-yum-plugin-0.5.8-26.el6.x86_64
yum-utils-1.1.30-41.el6.noarch
PackageKit-yum-0.5.8-26.el6.x86_64
yum-plugin-fastestmirror-1.1.30-41.el6.noarch
yum-metadata-parser-1.1.2-16.el6.x86_64
yum-3.2.29-81.el6.centos.noarch
yum-plugin-security-1.1.30-41.el6.noarch
[ root@centos6 ~]#
[ root@centos6 ~]# rpm -qa|grep yum|xargs rpm -e --allmatches --nodeps
[ root@centos6 ~]# rm -rf /etc/yum.repos.d/*
[ root@centos6 ~]#
[ root@centos6 ~]# whereis yum
yum: /etc/yum
[ root@centos6 ~]#
[ root@centos6 ~]# whereis yum | xargs rm -rf
[ root@centos6 ~]#
[ root@centos6 ~]# whereis yum
yum:
[ root@centos6 ~]#
[ root@centos6 ~]# cat /etc/issue
CentOS release 6.10(Final)
Kernel \r on an \m
[ root@centos6 ~]#
システムのバージョン番号に従って、ダウンロードするミラーを見つけます。
最初にCentosを検索してミラーのダウンロードを見つけ、次にミラーのダウンロードからミラーライブラリを見つけます。
これらはすべてミラーライブラリです。ダウンロードするシステムの正しいバージョンを見つけてください。
次のように、ミラーURLの後にパス / centos / 6.10 / os / x86_64 / Packages /
を設定して、ミラーライブラリのアドレスを見つけます。
pythonインストールディレクトリを作成します。
[ root@centos6 ~]# mkdir -p /usr/local/src/python
インストールファイルをダウンロードします。
wget http://mirrors.163.com/centos/6.10/os/x86_64/Packages/python-2.6.6-66.el6_8.x86_64.rpm
wget http://mirrors.163.com/centos/6.10/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.163.com/centos/6.10/os/x86_64/Packages/python-pycurl-7.19.0-9.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6.10/os/x86_64/Packages/python-devel-2.6.6-66.el6_8.x86_64.rpm
wget http://mirrors.163.com/centos/6.10/os/x86_64/Packages/python-libs-2.6.6-66.el6_8.x86_64.rpm
wget http://mirrors.163.com/centos/6.10/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
wget http://mirrors.163.com/centos/6.10/os/x86_64/Packages/rpm-python-4.8.0-59.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6.10/os/x86_64/Packages/python-setuptools-0.6.10-4.el6_9.noarch.rpm
ダウンロード後のrpmファイル:
[ root@centos6 python]# ls
python-2.6.6-66.el6_8.x86_64.rpm python-iniparse-0.3.1-2.1.el6.noarch.rpm python-pycurl-7.19.0-9.el6.x86_64.rpm rpm-python-4.8.0-59.el6.x86_64.rpm
python-devel-2.6.6-66.el6_8.x86_64.rpm python-libs-2.6.6-66.el6_8.x86_64.rpm python-urlgrabber-3.9.1-11.el6.noarch.rpm
[ root@centos6 python]#
インストールを実行します。
rpm -ivh python-* rpm-python-*
[ root@centos6 python]# rpm -ivh python-* rpm-python-*
Preparing... ########################################### [100%]package python-libs-2.6.6-66.el6_8.x86_64 is already installed
package python-2.6.6-66.el6_8.x86_64 is already installed
package python-pycurl-7.19.0-9.el6.x86_64 is already installed
package python-urlgrabber-3.9.1-11.el6.noarch is already installed
package python-devel-2.6.6-66.el6_8.x86_64 is already installed
package python-iniparse-0.3.1-2.1.el6.noarch is already installed
[ root@centos6 python]#
[ root@centos6 python]# python
Python 2.6.6(r266:84292, Aug 182016,15:13:37)[GCC 4.4.720120313(Red Hat 4.4.7-17)] on linux2
Type "help","copyright","credits" or "license"for more information.>>>exit()
yumインストールディレクトリを作成します。
mkdir -p /usr/local/src/yum
ダウンロードするrpmパッケージのパスを見つけます。
[ root@centos6 yum]# curl http://mirrors.163.com/centos/6.10/os/x86_64/Packages/>1.txt
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 859 k 0 859k 00 442k 0--:--:--0:00:01--:--:-- 451k
[ root@centos6 yum]# ls
1. txt
[ root@centos6 yum]# vim 1.txt
[ root@centos6 yum]#
[ root@centos6 yum]# cat 1.txt | grep yum | grep centos.noarch.rpm
< a href="kabi-yum-plugins-1.0-2.el6.centos.noarch.rpm">kabi-yum-plugins-1.0-2.el6.centos.noarch.rpm</a>07-Jul-201118:577724<a href="yum-3.2.29-81.el6.centos.noarch.rpm">yum-3.2.29-81.el6.centos.noarch.rpm</a>23-Mar-201723:04 1018K
< a href="yum-cron-3.2.29-81.el6.centos.noarch.rpm">yum-cron-3.2.29-81.el6.centos.noarch.rpm</a>23-Mar-201722:59 46K
[ root@centos6 yum]#
[ root@centos6 yum]# cat 1.txt | grep yum | grep yum-metadata-parser
< a href="yum-metadata-parser-1.1.2-16.el6.x86_64.rpm">yum-metadata-parser-1.1.2-16.el6.x86_64.rpm</a>26-Sep-201112:25 27K
[ root@centos6 yum]#
[ root@centos6 yum]# cat 1.txt | grep yum | grep yum-plugin-fastestmirror
< a href="yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm">yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm</a>20-Jun-201819:43 33K
[ root@centos6 yum]#
インストールファイルをダウンロードします。
wget http://mirrors.163.com/centos/6.10/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6.10/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6.10/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
wget http://mirrors.163.com/centos/6.10/os/x86_64/Packages/yum-utils-1.1.30-41.el6.noarch.rpm
wget http://mirrors.163.com/centos/6.10/os/x86_64/Packages/yum-plugin-protectbase-1.1.30-41.el6.noarch.rpm
wget http://mirrors.163.com/centos/6.10/os/x86_64/Packages/yum-plugin-aliases-1.1.30-41.el6.noarch.rpm
ダウンロードしたrpmパッケージ
[ root@centos6 yum]# ls
1. txt yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-protectbase-1.1.30-41.el6.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-utils-1.1.30-41.el6.noarch.rpm
yum-plugin-aliases-1.1.30-41.el6.noarch.rpm
[ root@centos6 yum]#
rpmパッケージをインストールします
[ root@centos6 yum]# rpm -ivh yum-*--force --nodeps
Preparing... ########################################### [100%]1:yum-metadata-parser ########################################### [17%]2:yum-plugin-fastestmirro########################################### [33%]3:yum ########################################### [50%]4:yum-utils ########################################### [67%]5:yum-plugin-aliases ########################################### [83%]6:yum-plugin-protectbase ########################################### [100%][root@centos6 yum]#
yumを実行します
[ root@centos6 yum]# yum
Loaded plugins: aliases, fastestmirror, protectbase
You need to give some command
Usage: yum [options] COMMAND
List of Commands:
alias Adds or lists aliases
check Check for problems in the rpmdb
check-update Check for available package updates
clean Remove cached data
deplist List a package's dependencies
distribution-synchronization Synchronize installed packages to the latest available versions
downgrade downgrade a package[root@centos6 yum]# ls /etc/yum.repos.d/[root@centos6 yum]#
Centos6のyumソースファイルが削除されており、再度取得する必要があることがわかります。
[ root@centos6 yum.repos.d]# cat CentOS-Base.repo
[ base]
name=CentOS-$releasever
enabled=1
failovermethod=priority
baseurl=http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.cloud.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-6
http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6[updates]
name=CentOS-$releasever
enabled=1
failovermethod=priority
baseurl=http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.cloud.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-6
http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6[extras]
name=CentOS-$releasever
enabled=1
failovermethod=priority
baseurl=http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.cloud.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-6
http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6[root@centos6 yum.repos.d]#
[ root@centos6 yum.repos.d]# cat epel.repo
[ epel]
name=Extra Packages for Enterprise Linux 6- $basearch
enabled=1
failovermethod=priority
baseurl=http://mirrors.cloud.aliyuncs.com/epel/6/$basearch
http://mirrors.aliyun.com/epel/6/$basearch
gpgcheck=0
gpgkey=http://mirrors.cloud.aliyuncs.com/epel/RPM-GPG-KEY-EPEL-6
http://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-6[root@centos6 yum.repos.d]#
[ root@centos6 yum.repos.d]# yum makecache
Loaded plugins: aliases, fastestmirror, protectbase
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base |3.7 kB 00:00
epel |4.7 kB 00:00
epel/filelists_db |7.9 MB 00:00
epel/updateinfo |817 kB 00:00
epel/prestodelta |1.3 kB 00:00
epel/other_db |3.0 MB 00:00
extras |3.4 kB 00:00
extras/prestodelta |2.2 kB 00:00
extras/other_db |14 kB 00:00
updates |3.4 kB 00:00
updates/filelists_db |3.0 MB 00:00
updates/prestodelta |153 kB 00:00
updates/other_db |213 kB 00:00
Metadata Cache Created
[ root@centos6 yum.repos.d]#
テストインストール:
[ root@centos6 yum.repos.d]# yum install -y tree
Loaded plugins: aliases, fastestmirror, protectbase
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
0 packages excluded due to repository protections
Resolving Dependencies
- - > Running transaction check
- - - > Package tree.x86_64 0:1.5.3-3.el6 will be installed
- - > Finished Dependency Resolution
さて、ここにyumがインストールされています。他にファイルがある場合は、次のドキュメントを参照してください。これも非常に便利です。
yumが指すpythonが2.6.6かどうかを確認します
[ root@centos6 python]# head -1/usr/bin/yum
#! /usr/bin/python
[ root@centos6 python]#
[ root@centos6 python]# head -1/usr/bin/yum
#! /usr/bin/python
[ root@centos6 python]# /usr/bin/python --version
Python 2.6.6[root@centos6 python]#
Recommended Posts