CentOS 7 yum源安装 VMware虚拟机

一.本地yum源的安装

1.第一步挂载本地ISO文件

mount /dev/cdrom /media

mount [需要挂载的设备] [挂载点]

linux使用外部设备都需要挂载到media或者mnt目录下

2.第二步新建repo文件

cd /etc/yum.repos.d
touch local.repo

.repo 后缀的文件记录yum源的信息

名字最好是挂载的文件的名字,方便以后的查看

3.编辑repo文件

vi /etc/yum.repos.d/local.repo
[local]                 //yum仓库的名称
name=local              //描述
baseurl=file:///media   //本地文件系统位置叙述
#ftp
#http://
gpgcheck=0              //时候进行检验 0不进行
enabled=1               //时候生效 0不生效

baseusrl还有其他两种方式
file://表示本地文件系统 / 表示根目录

4.加载repo文件

yum clean all //清除缓存
yum repolist  //加载显示yum源文件

在这里插入图片描述

repo id        //yum库名
repo name      //yum库描述
status        //rpm包的数量

二.网络yum源的安装

这个东西有一堆nginx,centos.org ,aliyun
这里就用aliyund的
这里不多说直接上有自带的教程
https://developer.aliyun.com/mirror/centos.

Centos7—其他版本这个网址里有

阿里云
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo


网易
wget -O /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo


清华
[base]
name=CentOS- r e l e a s e v e r − B a s e b a s e u r l = h t t p s : / / m i r r o r s . t u n a . t s i n g h u a . e d u . c n / c e n t o s / releasever - Base baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/ releaseverBasebaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/releasever/os/KaTeX parse error: Expected 'EOF', got '#' at position 11: basearch/ #̲mirrorlist=http…releasever&arch=$basearch&repo=os
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-7

#released updates
[updates]
name=CentOS- r e l e a s e v e r − U p d a t e s b a s e u r l = h t t p s : / / m i r r o r s . t u n a . t s i n g h u a . e d u . c n / c e n t o s / releasever - Updates baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/ releaseverUpdatesbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/releasever/updates/KaTeX parse error: Expected 'EOF', got '#' at position 11: basearch/ #̲mirrorlist=http…releasever&arch=$basearch&repo=updates
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-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 b a s e u r l = h t t p s : / / m i r r o r s . t u n a . t s i n g h u a . e d u . c n / c e n t o s / releasever - Extras baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/ releaseverExtrasbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/releasever/extras/KaTeX parse error: Expected 'EOF', got '#' at position 11: basearch/ #̲mirrorlist=http…releasever&arch=$basearch&repo=extras
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-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 b a s e u r l = h t t p s : / / m i r r o r s . t u n a . t s i n g h u a . e d u . c n / c e n t o s / releasever - Plus baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/ releaseverPlusbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/releasever/centosplus/KaTeX parse error: Expected 'EOF', got '#' at position 11: basearch/ #̲mirrorlist=http…releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-7


yum makecache就是把服务器的包信息下载到本地电脑缓存起来,makecache建立一个缓存,以后用install时就在缓存中搜索,提高了速度。

不用上网检索就能查找软件信息
配合yum -C search xxx使用

yum源出问题了,先打一套
看虚拟机cd有没有连接,内部有没有挂载
yum clean all
yum repolist

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值