SRPMを取得

表題の通り。SRPMを取得したい。

■ 環境

  • CentOS 6.9

■ yumdownloader

`yumdownloader`コマンドで取得することができる。まずはパッケージが入っているか確認から。

$ sudo yum list yum-utils
  :
Installed Packages
yum-utils.noarch     1.1.30-40.el6    @anaconda-CentOS-201703281317.x86_64/6.9
$

この環境では”yum-utils“パッケージがインストールされていたので`yumdownloader`コマンドもインストール済みである。

$ which yumdownloader
/usr/bin/yumdownloader
$

では、SRPMを取得する。

$ yumdownloader --source nginx

上記でダウンロードできたのだが、これはepelレポジトリからのダウンロードからであった。下記ファイルを見てみると”epel-source“のレポジトリが有効であった。

$ cat /etc/yum.repos.d/epel.repo
  :
[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
$

CentOS-Base.repo“ではソースを取得するレポジトリは有効になっていない、そもそも記載されていないので追記する必要がある。

$ cat /etc/yum.repos.d/CentOS-Base.repo
  :
[base-source]
name=CentOS-$full_releasever - Base source
baseurl=http://vault.centos.org/6.9/os/Source/
gpgcheck=1
gpgkey=http://vault.centos.org//RPM-GPG-KEY-CentOS-6
priority=1
enabled=1

[updates-source]
name=CentOS-$full_releasever - Updates Source
baseurl=http://vault.centos.org/6.9/updates/Source/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
priority=1
enabled=1
$

これでhttpdのSRPMも取得することはできた。

以上。