ToB企服应用市场:ToB评测及商务社交产业平台

标题: 【Linux】yum安装 [打印本页]

作者: 嚴華    时间: 2024-11-12 12:53
标题: 【Linux】yum安装
一、删除原来的yum源

1、检查yum源:

  1. rpm -qa | grep yum
复制代码
2、删除原来的yum源

  1. rpm -qa|grep yum|xargs rpm -e --nodeps
复制代码
3、防止系统自带的插件subscription-manager订阅管理器进行注册

  1. vi /etc/yum/pluginconf.d/subscription-manager.conf
  2. #enabled=1
复制代码
二、拷贝这三个安装包

如果没有可以从这个地址下载:https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/
yum-3.4.3-168.el7.centos.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
三、安装三个包

1、使用以下下令一次性安装3个包

  1. rpm -ivh yum-*
复制代码
2、检查是否安装成功

  1. rpm -qa |grep yum
复制代码
四、设置repo文件

1、在linux中进入etc文件,备份yum.repos.d文件

  1. cd /etc
  2. mv yum.repos.d yum.repos.d.bak
  3. mkdir yum.repos.d
复制代码
2、下载repo文件

  1. wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
复制代码
或者
  1. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
复制代码
3、修改下载好的repo文件

下载好的repo文件应该在etc/yum.repos.d目录下,里面应该也只有一个文件,直接vim 文件名
  1. vim /etc/yum.repos.d/CentOS-Base.repo
复制代码
把repo文件里全部 $releasever全部更换成版本号7
操作如下:
按下i键,然后按:
输入下令:
  1.                 %s/$releasever/7/g
复制代码
更换完毕后,按Esc,然后 :wq 生存退出vim模式
2)-3)也可以手工放入
  1. # CentOS-Base.repo
  2. #
  3. # The mirror system uses the connecting IP address of the client and the
  4. # update status of each mirror to pick mirrors that are updated to and
  5. # geographically close to the client.  You should use this for CentOS updates
  6. # unless you are manually picking other mirrors.
  7. #
  8. # If the mirrorlist= does not work for you, as a fall back you can try the
  9. # remarked out baseurl= line instead.
  10. #
  11. #
  12. [base]
  13. name=CentOS-7 - Base - mirrors.aliyun.com
  14. failovermethod=priority
  15. baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
  16.         http://mirrors.aliyuncs.com/centos/7/os/$basearch/
  17.         http://mirrors.cloud.aliyuncs.com/centos/7/os/$basearch/
  18. gpgcheck=1
  19. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  20. #released updates
  21. [updates]
  22. name=CentOS-7 - Updates - mirrors.aliyun.com
  23. failovermethod=priority
  24. baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
  25.         http://mirrors.aliyuncs.com/centos/7/updates/$basearch/
  26.         http://mirrors.cloud.aliyuncs.com/centos/7/updates/$basearch/
  27. gpgcheck=1
  28. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  29. #additional packages that may be useful
  30. [extras]
  31. name=CentOS-7 - Extras - mirrors.aliyun.com
  32. failovermethod=priority
  33. baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
  34.         http://mirrors.aliyuncs.com/centos/7/extras/$basearch/
  35.         http://mirrors.cloud.aliyuncs.com/centos/7/extras/$basearch/
  36. gpgcheck=1
  37. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  38. #additional packages that extend functionality of existing packages
  39. [centosplus]
  40. name=CentOS-7 - Plus - mirrors.aliyun.com
  41. failovermethod=priority
  42. baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/
  43.         http://mirrors.aliyuncs.com/centos/7/centosplus/$basearch/
  44.         http://mirrors.cloud.aliyuncs.com/centos/7/centosplus/$basearch/
  45. gpgcheck=1
  46. enabled=0
  47. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  48. #contrib - packages by Centos Users
  49. [contrib]
  50. name=CentOS-7 - Contrib - mirrors.aliyun.com
  51. failovermethod=priority
  52. baseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/
  53.         http://mirrors.aliyuncs.com/centos/7/contrib/$basearch/
  54.         http://mirrors.cloud.aliyuncs.com/centos/7/contrib/$basearch/
  55. gpgcheck=1
  56. enabled=0
  57. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
复制代码
4、清除缓存

  1. yum clean all
复制代码
5、重新天生缓存

  1. yum makecache
复制代码
6、yum 更新

  1. yum updateyum clean all
  2. && yum makecache
  3. && yum update
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4