はじめに
ローカルで仮想マシンを構築するとき、yum update
などで時間がかかるのでローカルにyumレポジトリを構築したいと思います。
実行環境
OS : CentOS 7
インストール
#yum install -y httpd createrepo rsync
webサーバの設定
#systemctl start httpd
#systemctl enable httpd
#firewall-cmd --zone=public --add-service=http --permanent
#firewall-cmd --reload
#echo '<directory "/var/www/html/centos">' > /etc/httpd/conf.d/centos-mirror.conf
#echo 'option +indexes' >> /etc/httpd/conf.d/centos-mirror.conf
#echo '</directory>' >> /etc/httpd/conf.d/centos-mirror.conf
ディレクトリ作成
#mkdir -p /var/www/html/centos/7/{os,updates,extras}/x86_64
レポジトリ作成
#rsync -rtpv --delete rsync://ftp.riken.jp/centos/7/os/ /var/www/html/centos/7/os/
#rsync -rtpv --delete rsync://ftp.riken.jp/centos/7/updates/ /var/www/html/centos/7/updates/
#rsync -rtpv --delete rsync://ftp.riken.jp/centos/7/extras/ /var/www/html/centos/7/extras/
おまけ
今回作成したディレクトリのサイズを確認してみました。
#du -sh /var/www/html/*
22G /var/www/html/centos
おわりに
思いのほか簡単にレポジトリサーバを構築できたので良かったです。