Copying To A Local Mirror / Repository

Home » CentOS » Copying To A Local Mirror / Repository
CentOS 3 Comments

I am using CentOS on a private network which can’t access the Internet so I want to create a local repository of packages on one or more DVDs, and get it installed on the private network. Someone had done this for CentOS 7, but not for CentOS 6. I have a VM running 6 so I am trying to create it for the previous major version. I thought there would be some obvious instructions on the preferred/recommended method for doing this, but I have failed to find them.

Can anyone respond with any useful links on how best to do this or provide the recommended set of steps. I have seen various postings on this topic, but not anything official from the CentOS community.

thanks much, Mark

MARK H RICHER, MS CS
Faculty Research Associate Computer Science Department Naval Postgraduate School – National Capital Region (NCR)
703-275-8533 (o) 571.303.9498 (m) mhricher@nps.edu

3 thoughts on - Copying To A Local Mirror / Repository

  • For CentOS-7 this is quite easy, mount the everything ISO and point to it. (Note, it is TOO BIG to fit on a DVD, so it needs to be on a thumb drive .. something that will hold at least 7.2 GB)

    We roll a new ISO every month, you can get the latest one here:

    http://buildlogs.CentOS.org/rolling/7/isos/x86_64/

    Currently CentOS-7-x86_64-Everything-1509-01.iso

    For 6, it is a bit harder, but not overly hard. Pick a mirror that is close from here:

    https://www.CentOS.org/download/mirrors/

    Rsync the /6/ tree from that mirror, excluding the ISOs if you do not want them. As an example, I will pick the mirrors.kernel.org for this example … this command:

    rsync mirrors.kernel.org::CentOS/6/

    shows this results:

    drwxr-xr-x 27 2014/10/19 16:36:15 SCL
    drwxrwxr-x 42 2015/07/28 04:57:54 CentOSplus drwxrwxr-x 27 2015/05/18 11:02:50 cloud drwxr-xr-x 42 2014/10/19 16:36:15 contrib drwxrwxr-x 42 2015/08/05 07:44:48 cr drwxr-xr-x 42 2014/10/19 16:36:15 extras drwxr-xr-x 42 2014/10/19 16:36:15 fasttrack drwxrwxr-x 42 2015/08/10 11:56:29 isos drwxr-xr-x 42 2015/07/25 08:20:23 os drwxrwxr-x 42 2015/08/03 05:39:35 updates drwxr-xr-x 27 2014/10/19 16:36:15 xen4

    So, you can exlude all except the trees you want, and rsync the rest.

    Put the os and updates directories (also bigger than 4.7 GB) on a drive and mount it somewhere on the other network.

    You can also do the same thing with the 7/ directory.

    With both the 6 or 7 directories, you just use apache to show the directories and and update from them by pointing to that location on your remote network.

  • Re: the last paragraph, it isn’t necessary to use apache. You can just specify the mounted location of the rsync’ed directories in your
    /etc/yum.repos.d/CentOS-Base.repo (or whatever else you need) using the baseurl=file://(location). E.g:

    [base]
    name=CentOS-$releasever – Base
    # Comment out the “mirrorlist” line so yum doesn’t try to use the network
    #mirrorlist=
    http://mirrorlist.CentOS.org/?release=$releasever&arch=$basearch&repo=os
    #
    baseurl=file:///disk/linux/CO6/os/x86_64/
    gpgcheck=1
    gpgkey=file:///disk/linux/CO6/os/x86_64/RPM-GPG-KEY-CentOS-6

    (etc.)


    Matt Phelps System Administrator, Computation Facility Harvard – Smithsonian Center for Astrophysics mphelps@cfa.harvard.edu, http://www.cfa.harvard.edu

  • Absolutely correct .. I was assuming that one wanted to make it available to multiple machines on a large network, etc.

    And even then it does not need to be apache, could be any web based server .. OR ftp .. OR NFS and mounted and pointed to on the local file system like you did above .. OR any number of other ways
    (glusterfs/ceph, etc).