Mirroring Centos Locally

When creating one off clusters, it is always handy to control package repositories. Getting the correct mix of kernel, Mellanox OFED, and CUDA driver versions is easier when you reference a static set of packages. I generally put a cluster’s package repositories on one of the NFS shares that get mounted globally.

The quick and easy way to make a mirror locally…

1
2
3
4
5
6
7
8
9
yum install -y createrepo yum-utils
mkdir -p /home/repo/centos/{base,extras,updates,centosplus} /home/repo/epel
reposync -g -l -d -m --repoid=base --newest-only --download-metadata --download_path=/home/repo/centos
reposync -g -l -d -m --repoid=extras --newest-only --download-metadata --download_path=/home/repo/centos/
reposync -g -l -d -m --repoid=updates --newest-only --download-metadata --download_path=/home/repo/centos/
reposync -g -l -d -m --repoid=centosplus --newest-only --download-metadata --download_path=/home/repo/centos/
reposync -g -l -d -m --repoid=epel --newest-only --download-metadata --download_path=/home/repo/epel/
createrepo /home/repo/centos
createrepo /home/repo/epel

Setting up yum:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
mv /etc/yum.repos.d/* /tmp/
cat <<EOF >/etc/yum.repos.d/local.repo
[centos]
name=Centos 7
baseurl=file:///home/repo/centos
enabled=1
gpgcheck=0
[epel]
name=EPEL 7
baseurl=file:///home/repo/epel
enabled=1
gpgcheck=0
EOF