RHEL7配置yum软件源
使用本地软件源
Ubuntu下使用kvm虚拟RHEL7,查看虚拟机的参数配置:
sudo vim /etc/libvirt/qemu/rhel7.8.xml
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/media/sandy/soft/学习/rhel-server-7.8-x86_64-dvd.iso'/>
<target dev='sdb' bus='sata'/>
<readonly/>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
重启虚拟机服务:
sudo service libvirtd restart
启动rhel服务器,在虚拟机内打开shell或者在主机用shell ssh连接到rhel服务器。
挂在光盘文件。
sudo mkdir -p /media/cdrom
sudo mount /dev/cdrom /media/cdrom
编辑yum本地源:
[root@rhel7 yum.repos.d]# cd /etc/yum.repos.d/
[root@rhel7 yum.repos.d]# vim rhel7.repo
[rhel7]
name=rhel7
baseurl=file:///media/cdrom
enabled=1
gpgcheck=0
替换为腾讯centos软件源
[root@rhel7 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.8 (Maipo)
腾讯软件源
https://mirrors.cloud.tencent.com/
[root@rhel7 ~]# cd /etc/yum.repos.d/
[root@rhel7 yum.repos.d]# rm -rf //清理存在xxx.repo
[root@rhel7 yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
[root@rhel7 yum.repos.d]# sed -i 's#$releasever#7#g' CentOS-Base.repo ###替换版本号,不然路径不对
[root@rhel7 yum.repos.d]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-7.repo
[root@rhel7 yum.repos.d]# sed -i 's#$releasever#7#g' epel.repo
[root@rhel7 yum.repos.d]# yum clean all && yum makecache
[root@rhel7 yum.repos.d]# yum repolist
参考:https://www.cnblogs.com/xiaochina/p/12423872.html