本地Yum仓库的配置<在无网络的情况下>
centos7yum仓库的配置
#.挂载光盘
[root@localhost~]#monut /dev/cdrom /mnt/ <临时挂载,重启后需要重新挂载>
[root@localhost~]#df -h <查看光盘是否挂载成功>
[root@localhost~]#cd /etc/yum.repos.d/
[root@localhost yum.repos.d]#ls
[root@localhost yum.repos.d]#cp CentOS-Base.repo{,.bak} 等同于
《[root@localhost yum.repos.d]#cp CentOS-Base.repo CentOS-Base.repo.bak》
[root@localhost yum.repos.d]#vim CentOS-Base.repo
[Base] ==>仓库id
name=CentOS - Base ==>仓库名称
baseurl=file:///mnt ==>yum仓库
gpgcheck=0
enable=1
保存退出
[root@localhost yum.repos.d]#yum clean all <清除缓存>
[root@localhost yum.repos.d]#yum repolist <列出仓库> (repolist如果是0,表示仓库错误)
centos8yum仓库的配置
#.挂载光盘
[root@localhost]#monut /dev/cdrom /mnt/ <临时挂载,重启后需要重新挂载>
[root@localhost~]#df -h <查看光盘是否挂载成功>
[root@localhost~]#cd /etc/yum.repos.d/
[root@localhost yum.repos.d]#ls
[root@localhost yum.repos.d]#cp CentOS-Base.repo{,.bak}
[root@localhost yum.repos.d]#cp CentOS-AppStream.repo{,.bak}
[root@localhost yum.repos.d]#vim CentOS-Base.repo
[BaseOS] ==>仓库id
name=CentOS - BaseOS ==>仓库名称
baseurl=file:///mnt/BaseOS ==>yum仓库
gpgcheck=0 ==>开机不做检查
enable=1 ==>开机自启
保存退出
[root@localhost yum.repos.d]#vim CentOS-AppStream.repo
[AppStream] ==>仓库id
name=CentOS - AppStream ==>仓库名称
baseurl=file:///mnt/AppStream ==>yum仓库
gpgcheck=0
enable=1
保存退出
[root@localhost yum.repos.d]#yum clean all <清除缓存>
[root@localhost yum.repos.d]#yum repolist <列出仓库> (repolist如果是0,表示仓库错误)
redhat7yum仓库的配置
#.挂载光盘
[root@localhost~]#monut /dev/cdrom /mnt/ <临时挂载,重启后需要重新挂载>
[root@localhost~]#cd /etc/yum.repos.d/
[root@localhost yum.repos.d]#ls
[root@localhost yum.repos.d]#vim rhel7.repo
[Base]
name=Base
baseurl=file:///mnt/
gpgcheck=0
enable=1
保存退出
[root@localhost yum.repos.d]#yum clean all
[root@localhost yum.repos.d]#yum repolist
redhat8yum仓库的配置
#.挂载光盘
[root@localhost~]#monut /dev/cdrom /mnt/ <临时挂载,重启后需要重新挂载>
[root@localhost~]#cd /etc/yum.repos.d/
[root@localhost yum.repos.d]#ls
[root@localhost yum.repos.d]#vim rhel8.repo
[Base]
name=Base
baseurl=file:///mnt/BaseOS
gpgcheck=0
enable=1
[AppStream]
name=AppStream
baseurl=file:///mnt/AppStream
gpgcheck=0
enable=1
保存退出
[root@localhost yum.repos.d]#yum clean all
[root@localhost yum.repos.d]#yum repolist