CentOS to build local Yum source in the CD

Source: Internet
Author: User
Tags gpg


The experiments are CentOS6.9 and CentOs7.3 systems 1. Mounting System Discs

There are two ways to mount a disc, one is to use the Magic directory of/MISC/CD, and the other is the mount method that we usually use.

1.1 Mount Mode Mount

[Root@centos7 ~]# mkdir/mnt/cdrom                          #创建挂载目录

1.2/misc This magical directory/misc this magical directory in CentOS6.9 is self-contained Centos7.3 need to install autofs this service

I have installed this service, if you do not press the install, you need to use the above method to install the installation package, or use other methods
//Someone only installed the installation package, or not, found that need to solve the dependency problem, if you do not, It is recommended that you first use the network Yum installation AutoFS to resolve the dependency problem
[Root@centos7 ~]# rpm-ivh/misc/cd/packages/autofs-5.0.7-56.el7.x86_64.rpm 
[ Root@centos7 ~]# systemctl Enable AutoFS #加入开机启动 [Root@centos7 ~]# systemctl Restart-autofs           #启动服务
[ Root@centos7 ~]# CD/MISC/CD                        #切换到这个目录 to see if success, must be CD this directory
[Root@centos7 cd]# pwd]/misc/cd
[ Root@centos7 cd]#
2. Modify the Yum file

2.1 View Yum source files

[Root@centos7 cd]# ll/etc/yum.repos.d/total
-rw-r--r--. 1 root 1664 Nov-2016 CENTOS-BASE.REPO
   #网络yum源
-rw-r--r--. 1 root root 1309 Nov  2016 Centos-cr.repo-rw-r--r
--. 1 root root  649 Nov  2 016 Centos-debuginfo.repo
-rw-r--r--. 1 root  Nov 2016  Centos-fasttrack.repo
. 1 root  648 June  3 16:25 centos-media.repo #可以配置本地yum source
-rw-r--r--. 1 root 1331  Nov-2016 Ce Ntos-sources.repo
-rw-r--r--. 1 root 2893 Nov  2016 Centos-vault.repo

2.2 Modifying Centos-media.repo files
Before modification:

[Root@centos7 ~]# Vi/etc/yum.repos.d/centos-media.repo #
Centos-media.repo
#
This  repo can be used With mounted DVD Media, verify the mount point for
#  CentOS-7.  You can use this repo and yum to install items directly off the
#  DVD ISO so we release.
#
To use this repo, put on your DVD and use it with the other repos too:
#  yum--enablerepo=c7-media [com Mand]
#  
or for only the media repo, does this:
#
#  Yum--disablerepo=\*--enablerepo=c7-media [C Ommand]

[C7-media]
name=centos-$releasever-media
baseurl=file:///media/centos/   #这里有修改
        file:///media/cdrom/
        file:///media/cdrecorder/
gpgcheck=1
enabled=0                       #这里有修改
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7

After modification:

# Centos-media.repo # # This  repo can is used with mounted DVD Media, verify the mount point for
#  Cen TOS-7.  You can use this repo and yum to install items directly off the
#  DVD ISO so we release.
#
To use this repo, put on your DVD and use it with the other repos too:
# yum--enablerepo=c7-media  [comm and]
# #  
or for only the media repo, does this:
#
#  Yum--disablerepo=\*--enablerepo=c7-media [Co Mmand]

[C7-media]
name=centos-$releasever-media
baseurl=file:///misc/cd/
        file:///media/ centos/
        file:///media/cdrom/
        file:///media/cdrecorder/
gpgcheck=1
enabled=1
gpgkey= File:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

2.3 Setting does not get Yum source from Network

#把这个文件重命名加上. bak bypasses network yum source
[Root@centos7 ~]# Mv/etc/yum.repos.d/centos-base.repo{,.bak}
3. Detect if local source is successful
#[root@centos7 ~]# Yum List zlib-devel.i686 1.2.7-17.el7 C7-media zlib-devel.x86_64 1.2.7-17.E                                                        L7 C7-media zlib-static.i686                                                      1.2.7-17.el7 C7-media zlib-static.x86_64                                                              1.2.7-17.el7 C7-media zsh.x86_64                                                         5.0.2-25.el7 C7-media zsh-html.x86_64                                                            5.0.2-25.el7 C7-media zziplib.i686 0.13.62-5.el7 C7-media zziplib.x8                    6_64                                      0.13.62-5.el7 C7-media zziplib-devel.i686 0.13.62-5.el7 C7-media Zziplib-de  
vel.x86_64 0.13.62-5.el7 C7-media                                       Zziplib-utils.x86_64 0.13.62-5.EL7 C7-media
The local Yum source is complete and you can use the Yum command to install the software
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.