[CentOS] copying to a local mirror / repository

Thu Oct 15 12:15:49 UTC 2015
Phelps, Matthew <mphelps at cfa.harvard.edu>

On Wed, Oct 14, 2015 at 6:53 PM, Johnny Hughes <johnny at centos.org> wrote:

> On 10/14/2015 04:49 PM, Richer, Mark (CIV) wrote:
> > 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
>
> 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 at cfa.harvard.edu, http://www.cfa.harvard.edu