基于centos7.4 重装python和yum
删除现有python和yum
1 2 3 4 5 6 7
| 1、删除现有Python [root@test ~]# rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps ##强制删除已安装程序及其关联 [root@test ~]# whereis python |xargs rm -frv ##删除所有残余文件 ##xargs,允许你对输出执行其他某些命令 [root@test ~]# whereis python ##验证删除,返回无结果 2、删除现有的yum [root@test ~]# rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps [root@test ~]# whereis yum |xargs rm -frv
|
下载安装
查看系统版本信息命令
1 2 3 4 5 6 7
| ## lsb_release -a 查看系统版本信息命令 [root@izm5e7klp5h59pozbv3fghz nginx]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.4.1708 (Core) Release: 7.4.1708 Codename: Core
|
下载资源包
下载对应版本的资源包: http://vault.centos.org/7.4.1708/os/x86_64/Packages(根据自己系统版本调整链接)
当前下载路径为: /usr/java/python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http: wget http:
|
安装
安装python
1 2
| cd /usr/java/python rpm -ivh python-* rpm-python-*
|
安装yum
1 2
| cd /usr/java/yum rpm -ivh yum-* libxml*
|
注 参数 –nodeps –force: 调过依赖,强制安装
示例: rpm -ivh yum-* –nodeps –force
修改yum源
修改yum源,在安装更新rpm包时获得比较理想的速度。国内比较快的有163源、sohu源。这里以163源为例子。
1 2 3 4 5
| cd /etc/yum.repos.d mv CentOS-Base.repo CentOS-Base.repo.backup wget http: mv CentOS6-Base-163.repo CentOS-Base.repo yum clean all
|