【引言】
今天做一个实验,要用到yum方式安装一个资源组。因自己的笔记本使用vmware虚拟的linux7.2环境,且超出两周没升级过yum源,因此需先行升级下yum,本文记录之,以备存。
操作步骤如下:
1. 备份默认的yum
# mv /etc/yum.repos.d /etc/yum.repos.d.backup
2. 设置新的yum目录
# mkdir /etc/yum.repos.d
3. 下载阿里yum配置到该目录中
下载wget
# yum install -y wget
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
4. 重建缓存
# yum clean all# yum makecache
# yum clean all
# yum makecache
[root@ethanyang yum.repos.d]# yum clean all
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: base centosplus extras updates
Cleaning up everything
[root@ethanyang yum.repos.d]# yum makecache
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
base | 3.6 kB 00:00:00
centosplus | 2.9 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/13): base/x86_64/group_gz | 165 kB 00:00:00
(2/13): base/x86_64/filelists_db | 7.3 MB 00:00:08
(3/13): base/x86_64/primary_db | 6.0 MB 00:00:08
(4/13): base/x86_64/other_db | 2.6 MB 00:00:02
(5/13): centosplus/x86_64/filelists_db | 1.2 MB 00:00:02
(6/13): centosplus/x86_64/other_db | 69 kB 00:00:00
(7/13): centosplus/x86_64/primary_db | 2.7 MB 00:00:03
(8/13): extras/x86_64/filelists_db | 216 kB 00:00:00
(9/13): extras/x86_64/other_db | 106 kB 00:00:00
(10/13): extras/x86_64/primary_db | 164 kB 00:00:01
(11/13): updates/x86_64/filelists_db | 4.0 MB 00:00:03
(12/13): updates/x86_64/other_db | 493 kB 00:00:00
(13/13): updates/x86_64/primary_db | 6.7 MB 00:00:06
Metadata Cache Created
[root@ethanyang yum.repos.d]#
5. 升级所有包
yum update -y
注意:
第一次运行yum安装软件前,建议更新yum。
yum update -y改变软件设置和系统设置,系统版本内核都升级,需几分钟耐心等待。
另,熟悉linux的亲,可能还熟悉升级方式有upgrade,这里简述下区别:
升级内容
yum -y update:升级所有包同时也升级软件和系统内核;
yum -y upgrade:只升级所有包,不升级软件和系统内核。
使用范围
yum -y update:需要更新内核;
yum -y upgrade:更新系统时,软件和内核保持原样。