Устанавливаем необходимое ПО:
# yum install -y wget rsync createrepo httpd
Создаем папку для хранения пакетов:
# mkdir -pv /var/www/html/centos/6.5/{os,updates}/x86_64
Синхронизируем наш репозиторий с репозиторием от яндекса:
rsync -iavrt rsync://mirror.yandex.ru/centos/6.5/os/x86_64/ /var/www/html/centos/6.5/os/x86_64/ rsync -iavrt rsync://mirror.yandex.ru/centos/6.5/updates/x86_64/ /var/www/html/centos/6.5/updates/x86_64/
Поскольку по rsync копируются не только rpm-ки, но и заголовки репозитория, то запуск createrepo выполнять не требуется.
# cd /var/www/html/centos # wget http://mirror.yandex.ru/centos/RPM-GPG-KEY-CentOS-6
Подключаемся к серверу по 80 порту и проверяем, все ли работает нормально.
Теперь наш репозиторий необходимо протестировать.
Удаляем старые файлы с описанием репозиториев:
# rm -rf /etc/yum.repos.d/*
Создаем новый файл с описанием репозитория:
# vi /etc/yum.repos.d/my-local-centos.repo
Вставляем в него:
[base] name=CentOS-$releasever - $basearch - Base enabled=1 baseurl=http://repo.otriadnov.ru/centos/6.5/os/$basearch/ gpgcheck=1 gpgkey=http://repo.otriadnov.ru/centos/RPM-GPG-KEY-CentOS-6 [update] name=CentOS-$releasever - $basearch - Updates enabled=1 baseurl=http://repo.otriadnov.ru/centos/6.5/updates/$basearch/ gpgcheck=1 gpgkey=http://repo.otriadnov.ru/centos/RPM-GPG-KEY-CentOS-6
repo.otriadnov.ru - разумеется должен быть резолвиться в DNS или быть прописан в hosts машины, которую планируется обновлять из этого репозитория.
Запускаем yum list для проверки.
# yum list # yum repolist Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile repo id repo name status base CentOS-6 - x86_64 - Base 6,367 update CentOS-6 - x86_64 - Updates 287 repolist: 6,654
# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base update
Cleaning up Everything
Cleaning up list of fastest mirrors
# yum check-update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
ca-certificates.noarch 2013.1.95-65.1.el6_5 update
ethtool.x86_64 2:3.5-1.2.el6_5 update
nss.x86_64 3.15.3-3.el6_5 update
nss-sysinit.x86_64 3.15.3-3.el6_5 update
nss-tools.x86_64 3.15.3-3.el6_5 update
openssl.x86_64 1.0.1e-16.el6_5.1 update
tzdata.noarch 2013i-1.el6 update
yum.noarch 3.2.29-43.el6.centos update
# yum update
# yum info openssl.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Installed Packages
Name : openssl
Arch : x86_64
Version : 1.0.1e
Release : 16.el6_5.1
Size : 4.0 M
Repo : installed
From repo : update
Summary : A general purpose cryptography library with TLS implementation
URL : http://www.openssl.org/
License : OpenSSL
Description : The OpenSSL toolkit provides support for secure communications between
: machines. OpenSSL includes a certificate management tool and shared
: libraries which provide various cryptographic algorithms and
: protocols.