码迷,mamicode.com
首页 > 其他好文 > 详细

建立本地yum仓库

时间:2019-08-13 17:20:35      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:baseurl   term   code   prim   rmi   loaded   deb   style   fas   

[root@ks-server ~]# cd /etc/yum.repos.d/[root@ks-server yum.repos.d]# ls
CentOS-Base.repo       CentOS-Media.repo
CentOS-CR.repo         CentOS-Sources.repo
CentOS-Debuginfo.repo  CentOS-Vault.repo
CentOS-fasttrack.repo
[root@ks-server yum.repos.d]# mkdir bak
[root@ks-server yum.repos.d]# ls
bak                    CentOS-fasttrack.repo
CentOS-Base.repo       CentOS-Media.repo
CentOS-CR.repo         CentOS-Sources.repo
CentOS-Debuginfo.repo  CentOS-Vault.repo
[root@ks-server yum.repos.d]# mv *.repo bak/
[root@ks-server yum.repos.d]# ls
bak

#将原先/etc/yum.repos.d/里存在的都移除(备份)

[root@ks-server yum.repos.d]# mount /dev/sr0 /mnt
mount: /dev/sr0 is write-protected, mounting read-only
[root@ks-server yum.repos.d]# ls /mnt
CentOS_BuildTag  LiveOS
EFI              Packages
EULA             repodata
GPL              RPM-GPG-KEY-CentOS-7
images           RPM-GPG-KEY-CentOS-Testing-7
isolinux         TRANS.TBL

#挂载光盘镜像

[root@ks-server yum.repos.d]# cat local.repo 
[localrepo]
name=localrepo
baseurl=file:///mnt
gpgcheck=0
enabled=1

编写repo文件

[root@ks-server yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: localrepo
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@ks-server yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
localrepo               | 3.6 kB     00:00     
(1/2): localrepo/group_gz | 166 kB   00:00     
(2/2): localrepo/primary_ | 3.1 MB   00:00     
repo id             repo name            status
localrepo           localrepo            3,971
repolist: 3,971

#清理检测

建立本地yum仓库

标签:baseurl   term   code   prim   rmi   loaded   deb   style   fas   

原文地址:https://www.cnblogs.com/zzzhbr/p/11346885.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!