建立本地yum仓库

Posted zzzhbr

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了建立本地yum仓库相关的知识,希望对你有一定的参考价值。

[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仓库的主要内容,如果未能解决你的问题,请参考以下文章

建立本地yum仓库

红帽6如何设置网络和建立yum仓库(小白,说直白点)

创建本地yum仓库

从建立yum仓库到搭建ftp以及http服务

自建yum仓库,分别为网络源和本地源

ret hat 6 ,ret hat 7 YUM仓库建立