REDHAT 7 本地源与yum网络源配置

本地yum源配置

在我们新安装的 REDHAT 7 系统中并不存在配置源,我们使用的系统中为了节省空间,提高运行的效率,往往有非常多的包是没有安装的;当我们发现有包缺失时,需要我们自行安装;安装就需要运用到yum源;配置本地源可以在没有网络的情况下进行包的安装。

df -h 对磁盘容量察看,发现没有 sr0 ,所以第一步就要先对磁盘进行挂载处理。
温馨提示:如果没有 sr0 就无法使用本地源

[root@deng- order]# df -h
文件系统        容量  已用  可用 已用% 挂载点
/dev/sda2        10G  1.3G  8.8G   13% /
devtmpfs        286M     0  286M    0% /dev
tmpfs           296M     0  296M    0% /dev/shm
tmpfs           296M  8.8M  287M    3% /run
tmpfs           296M     0  296M    0% /sys/fs/cgroup
/dev/sda3       9.6G   33M  9.5G    1% /data
/dev/sda1       497M  112M  385M   23% /boot
tmpfs            60M     0   60M    0% /run/user/0
/dev/sdb1       976M  2.6M  907M    1% /d1

sr0 挂载到根目录 iso 目录下 :mount /dev/sr0 /iso

[root@deng- order]# df -h
文件系统        容量  已用  可用 已用% 挂载点
/dev/sda2        10G  1.3G  8.8G   13% /
devtmpfs        286M     0  286M    0% /dev
tmpfs           296M     0  296M    0% /dev/shm
tmpfs           296M  8.8M  287M    3% /run
tmpfs           296M     0  296M    0% /sys/fs/cgroup
/dev/sda3       9.6G   33M  9.5G    1% /data
/dev/sda1       497M  112M  385M   23% /boot
/dev/sr0        3.8G  3.8G     0  100% /iso
tmpfs            60M     0   60M    0% /run/user/0
/dev/sdb1       976M  2.6M  907M    1% /d1

挂载完成后对 /etc/yum.repos.d/base.repo 进行修改

[root@deng- ~]# vim /etc/yum.repos.d/base.repo 
[base]
name=base
baseurl=file:///iso
enabled=1
gpgcheck=0  

在此本地源的配置以完成

yum网络源配置

如果在 REDHAT 7 系统中,单纯只有本地源往往是不够的,本地源的安装包有限,然而就需要用到我们的网络源。运用网络源的前提,必须要有网络。

网络源的地址:
阿里巴巴开源镜像站 :https://mirrors.aliyun.com
网易开源镜像站 : https://mirrors.163.com

[base]
name=base
baseurl=file:///iso
enabled=1
gpgcheck=0

[163.com]
name=163.com
baseurl= https://mirrors.163.com/centos/7/os/x86_64/
enabled=1
gpgcheck=0

[aliyun]
name=aliyun
baseurl= https://mirrors.aliyun.com/centos/7/os/x86_64/
enabled=1
gpgcheck=0

源可以放在下方进行添加,当第一个源没有包的时候会选择第二个源,源可以多选。

redhat 7.2 可用的yum源, 亲自测试可以使用使用过程: 1.卸载已经存在的yum: rpm -qa | grep yum | xargs rpm -e --nodeps 2.将yum 文件放到server中 3.执行rpm -ivh yum-* 4.创建repo文件: #CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$7 - Base - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch;=$basearch&repo=os baseurl=http://mirrors.163.com/centos/7/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$7 - Updates - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch;=$basearch&repo=updates baseurl=http://mirrors.163.com/centos/7/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$7 - Extras - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch;=$basearch&repo=extras baseurl=http://mirrors.163.com/centos/7/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$7 - Plus - 163.com baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 5.测试是否安装成功 yum -y install tree
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值