Yum - yusukew62/docs GitHub Wiki
Yum
Yumリポジトリ作成・公開
自作Yumリポジトリ作成手順
createrepoのインストール
# yum install createrepo
httpdのインストール
# yum install httpd
httpdの起動
# service httpd start
rpmパッケージの配置
# mkdir -p /var/www/html/el6/
# mv *.rpm /var/www/html/el6/
リポジトリの作成
# createrepo /var/www/html/el6/
階層の確認
# tree /var/www/html/el6/
/var/www/html/el6/
├── ldns-1.6.17-1.el6.x86_64.rpm
├── ldns-debuginfo-1.6.17-1.el6.x86_64.rpm
├── ldns-devel-1.6.17-1.el6.x86_64.rpm
├── ldns-python-1.6.17-1.el6.x86_64.rpm
└── repodata
├── 04013773d39131ad8342add15c313a8ec262ae0bd06d55d49ed59b4b61457bf2-primary.xml.gz
├── 25a763685fb24458369a0dd25783b859bb4b3bbb5963d2049b5160e64293ee4b-other.sqlite.bz2
├── 6bfa012778600e4df06c197209f12bd14fa93a7f64ff19a93f1f12cdbdb8907d-filelists.xml.gz
├── 799cd873db373bb4cd3da1478c4d430137c380807666f729ebea7724eead5627-primary.sqlite.bz2
├── a408c8b2eea801c7252644afdec9313a9402f9373037fb8a29469a4c505fdd0e-other.xml.gz
├── ee42c3fa25ce322082568196d79b38b5c72cc5b370ad8f01b58133e38c2641b8-filelists.sqlite.bz2
└── repomd.xml
1 directory, 11 files
repoファイルの作成
# cat /etc/yum.repos.d/yusukew62.local.repo
[yusukew62.local]
name=yusukew62.local
baseurl=http://192.168.1.61/el6/
enabled=1
gpgcheck=0
リポジトリデータの削除
# yum clean all
読み込んだプラグイン:fastestmirror
リポジトリーを清掃しています: base base-src extras extras-src updates updates-src yusukew62 yusukew62.local
すべて掃除しています
Cleaning up list of fastest mirrors
動作確認
# yum repolist
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* updates: ftp.iij.ad.jp
リポジトリー ID リポジトリー名 状態
base CentOS-6 - Base 6,696
base-src CentOS-6.8 - Base - Source 2,171
extras CentOS-6 - Extras 63
extras-src CentOS-6.8 - Extras - Source 38
updates CentOS-6 - Updates 825
updates-src CentOS-6.8 - Updates - Source 146
yusukew62 yusukew62 4
yusukew62.local yusukew62.local 4
repolist: 9,947
GitHubに自作Yumリポジトリを公開する方法
createrepoのインストール
# yum install createrepo
GitHub上にリポジトリの作成
GitHub上にリポジトリを作成する
yumリポジトリ用ディレクトリの作成
# git clone <作成したリポジトリのURL>
yumリポジトリの作成
ここでは rpm.repo がリポジトリ名とする
# mkdir -p rpm.repo/el6/
# cp -p *rpm rpm.repo/el6/
# createrepo rpm.repo/el6/
# git push origin master
repoファイル作成
# cat /etc/yum.repos.d/yusukew62.repo
[yusukew62]
name=yusukew62
baseurl=https://github.com/yusukew62/rpm.repo/raw/master/el6/
enabled=1
gpgcheck=0
動作確認
# yum clean all
# yum repolist
以下を確認
- 作成したリポジトリID、リポジトリ名が表示されること
- 状態にリポジトリに含めたRPMパッケージ数が表示されること
外部リポジトリ
EPEL
# wget http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
# yum localinstall epel-release-6-8.noarch.rpm
リポジトリ優先度
yum-plugin-priorities
yum-plugin-priorities でリポジトリに優先度をつけることが可能
# yum install yum-plugin-priorities
インストール後 /etc/yum.repo.d/ のリポジトリ定義に priorityパラメータを記載することで優先度がつけられる