Linux一步一步教你如何安装yum(附带一个阿里云的镜像库配置文件)

1.将Linux系统的iso镜像文件上传到Linux中
2.将文件挂载到/mnt(这个文件夹随意)下
3.先查看挂载路径:df -h 然后设置永久挂载: vim /etc/fstab 去将文件修改下 (此步骤可不做)
4. 去挂载文件下的安装包文件 :cd /mnt/Packages/
5.执行这三个命令去安装三个yum文件(自己看自己包下面相对应的版本,不一定跟下面的版本一样,打前面几个字母用tab补全就行了):
rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -ivh yum-3.4.3-118.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-24.el7.noarch.rpm
6.最后清一下缓存加载元数据:yum clean all && yum makecache

可以自行配置/etc/yum.repos.d/下面的repo文件:
aliyun.repo (阿里云的镜像文件):
[base]
name=CentOS- r e l e a s e v e r − B a s e − m i r r o r s . a l i y u n . c o m f a i l o v e r m e t h o d = p r i o r i t y b a s e u r l = h t t p : / / m i r r o r s . a l i y u n . c o m / c e n t o s / releasever - Base - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/ releaseverBasemirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/releasever/os/ b a s e a r c h / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / basearch/ http://mirrors.aliyuncs.com/centos/ basearch/http://mirrors.aliyuncs.com/centos/releasever/os/ b a s e a r c h / h t t p : / / m i r r o r s . c l o u d . a l i y u n c s . c o m / c e n t o s / basearch/ http://mirrors.cloud.aliyuncs.com/centos/ basearch/http://mirrors.cloud.aliyuncs.com/centos/releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS- r e l e a s e v e r − U p d a t e s − m i r r o r s . a l i y u n . c o m f a i l o v e r m e t h o d = p r i o r i t y b a s e u r l = h t t p : / / m i r r o r s . a l i y u n . c o m / c e n t o s / releasever - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/ releaseverUpdatesmirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/releasever/updates/ b a s e a r c h / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / basearch/ http://mirrors.aliyuncs.com/centos/ basearch/http://mirrors.aliyuncs.com/centos/releasever/updates/ b a s e a r c h / h t t p : / / m i r r o r s . c l o u d . a l i y u n c s . c o m / c e n t o s / basearch/ http://mirrors.cloud.aliyuncs.com/centos/ basearch/http://mirrors.cloud.aliyuncs.com/centos/releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS- r e l e a s e v e r − E x t r a s − m i r r o r s . a l i y u n . c o m f a i l o v e r m e t h o d = p r i o r i t y b a s e u r l = h t t p : / / m i r r o r s . a l i y u n . c o m / c e n t o s / releasever - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/ releaseverExtrasmirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/releasever/extras/ b a s e a r c h / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / basearch/ http://mirrors.aliyuncs.com/centos/ basearch/http://mirrors.aliyuncs.com/centos/releasever/extras/ b a s e a r c h / h t t p : / / m i r r o r s . c l o u d . a l i y u n c s . c o m / c e n t o s / basearch/ http://mirrors.cloud.aliyuncs.com/centos/ basearch/http://mirrors.cloud.aliyuncs.com/centos/releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS- r e l e a s e v e r − P l u s − m i r r o r s . a l i y u n . c o m f a i l o v e r m e t h o d = p r i o r i t y b a s e u r l = h t t p : / / m i r r o r s . a l i y u n . c o m / c e n t o s / releasever - Plus - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/ releaseverPlusmirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/releasever/centosplus/ b a s e a r c h / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / basearch/ http://mirrors.aliyuncs.com/centos/ basearch/http://mirrors.aliyuncs.com/centos/releasever/centosplus/ b a s e a r c h / h t t p : / / m i r r o r s . c l o u d . a l i y u n c s . c o m / c e n t o s / basearch/ http://mirrors.cloud.aliyuncs.com/centos/ basearch/http://mirrors.cloud.aliyuncs.com/centos/releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#contrib - packages by Centos Users
[contrib]
name=CentOS- r e l e a s e v e r − C o n t r i b − m i r r o r s . a l i y u n . c o m f a i l o v e r m e t h o d = p r i o r i t y b a s e u r l = h t t p : / / m i r r o r s . a l i y u n . c o m / c e n t o s / releasever - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/ releaseverContribmirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/releasever/contrib/ b a s e a r c h / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / basearch/ http://mirrors.aliyuncs.com/centos/ basearch/http://mirrors.aliyuncs.com/centos/releasever/contrib/ b a s e a r c h / h t t p : / / m i r r o r s . c l o u d . a l i y u n c s . c o m / c e n t o s / basearch/ http://mirrors.cloud.aliyuncs.com/centos/ basearch/http://mirrors.cloud.aliyuncs.com/centos/releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值