2013年2月8日金曜日

#AWS で、Amazon LinuxのRPMを再ビルドする


Amazon EC2も使ったりしている @snicker_jp です。

ちょっと、今日気になることがあったので、そのネタです。

きっかけ


Amazon Linuxには、nagiosパッケージがあるらしい!
でも、日本語化したいよね!?

src.rpm持ってきて、ここ↓見て、再ビルドすればいいじゃね!?

元うなぎ屋: Nagios 3.4.1 の日本語RPMを作ってみたよ
http://snickerjp.blogspot.com/2012/11/nagios-341-rpm.html

それに、yum使えんならソースのRPMは「yumdownloader」で持ってこれるよ ( ̄▽+ ̄*)キラン

書式:
yumdownloader --source パッケージ名

yumdownloader --source nagios

No source RPM found for nagios-3.4.1-2.3.amzn1.x86_64
No source RPM found for nagios-3.3.1-3.4.amzn1.x86_64

げっ!∑(゚ω゚ノ)ノ

ないの!?

で、検索してみた。

SIOS "OSSよろず" ブログ出張所: ソースの入手と再ビルド ~ Amazon Linux AMI (EC2) 編 
http://sios-oss.blogspot.com/2011/12/amazon-linux-ami-ec2.html

あったw

get_reference_source」を使うらしいです。



やってみました!( ー`дー´)キリッ

get_reference_source --aws-account-id=XXXX-XXXX-XXXX --package=nagios

Usage: get_reference_source [-d] <-p package>

get_reference_source: error: no such option: --aws-account-id

げっ!∑(゚ω゚ノ)ノ オプション変わってるヤーン!

で、再度やり直し

get_reference_source -p nagios
No source rpm found for: nagios
Please install the binary package for which you have requested source.

げっ!∑(゚ω゚ノ)ノ ソースないの!?

試しに、ちょっと他のでできないかな?www

$ yum search nagios
Loaded plugins: priorities, security, update-motd, upgrade-helper
amzn-main                                                | 2.1 kB     00:00
amzn-main/primary_db                                     | 2.2 MB     00:11
amzn-updates                                             | 2.3 kB     00:00
amzn-updates/primary_db                                  | 668 kB     00:00
epel/metalink                                            | 4.4 kB     00:00
epel                                                     | 4.3 kB     00:00
epel/primary_db                                          | 5.0 MB     00:00
515 packages excluded due to repository priority protections
epel/pkgtags                                             |  327 B     00:00
============================= N/S Matched: nagios ==============================
nagios.x86_64 : Nagios monitors hosts and services and yells if somethings
              : breaks
nagios-common.x86_64 : Provides common directories, uid and gid among
                     : nagios-related packages
nagios-devel.x86_64 : Provides include files that Nagios-related applications
                    : may compile against
nagios-lcgdm.x86_64 : Configuration files for a (DPM/LFC) site monitored using
                    : LCGDM nagios probes
nagios-plugins.x86_64 : Host/service/network monitoring program plugins for
                      : Nagios
~略~

「nagios-common」で試しにやってみたw
$ get_reference_source -d -p nagios-common

Requested package: nagios-common
Found package from local RPM database: nagios-common-3.4.1-2.3.amzn1.x86_64
Corresponding source RPM to found package : nagios-3.4.1-2.3.amzn1.src.rpm

Debug mode: Enabled
Instance-id : i-8d7d268e
Region : ap-northeast-1

Are these parameters correct? Please type 'yes' to continue: yes
Package SRPM is located at: https://alami-source-us-east-1.s3.amazonaws.com/SRPMS/nagios-3.4.1-2.3.amzn1.src.rpm?Signature=j3lNL6JoVXXXXa1Q%3D&Expires=136XXXX&AWSAccessKeyId=AKIAIXXXXX

え!∑(゚ω゚ノ)ノ あるの!?

「てか、さっきなんでダメなん?」とか思いながら、同時作業していたから他の人がビルドしたのかな?と中身を見てみた。
$ less nagios-3.4.1-2.3.amzn1.src.rpm
Name        : nagios                       Relocations: (not relocatable)
Version     : 3.4.1                             Vendor: Amazon.com
Release     : 2.3.amzn1                     Build Date: Mon 15 Oct 2012 07:22:53 AM JST
Install Date: (not installed)               Build Host: build-31006.build
Group       : Applications/System           Source RPM: (none)
Size        : 1830017                          License: GPLv2
Signature   : RSA/8, Wed 24 Oct 2012 09:48:27 AM JST, Key ID bcb4a85b21c0f39f
Packager    : Amazon.com, Inc. <http://aws.amazon.com>
URL         : http://www.nagios.org/
Summary     : Nagios monitors hosts and services and yells if somethings breaks
Description :
Nagios is a program that will monitor hosts and services on your
network.  It has the ability to send email or page alerts when a
problem arises and when a problem is resolved.  Nagios is written
in C and is designed to run under Linux (and some other *NIX
variants) as a background process, intermittently running checks
on various services that you specify.

The actual service checks are performed by separate "plugin" programs
which return the status of the checks to Nagios. The plugins are
available at http://sourceforge.net/projects/nagiosplug.

This package provides the core program, web interface, and documentation
files for Nagios. Development files are built as a separate package.
* Sun Oct 14 2012 Cristian Gafton <gafton@amazon.com>
- add httpd to the post-scripts requires

* Mon Jul 23 2012 Cristian Gafton <gafton@amazon.com>
- import source package EPEL6/nagios-3.4.1-2.el6

* Thu Jun 28 2012 Petr Pisar <ppisar@redhat.com> - 3.4.1-2
- Perl 5.16 rebuild

あ、やっぱりAmazonだわ・・・。
で、ここからリビルドしました。

下記に保存されるようです。
$ ll /usr/src/srpm/debug/
total 1772
-rw------- 1 snicker_jp snicker_jp 1812060 Feb  8 16:15 nagios-3.4.1-2.3.amzn1.src.rpm

その後:

結局、他のEC2インスタンスでやってはみたものの・・・
$ get_reference_source -d -p nagios-common
No source rpm found for: nagios-common
Please install the binary package for which you have requested source.

$ get_reference_source -p nagios
No source rpm found for: nagios
Please install the binary package for which you have requested source.
ずーっと、このメッセージが出て来てどーにもなりませんでしたw
試しに「bash」で確認してみた。
$ get_reference_source -p bash

Requested package: bash
Found package from local RPM database: bash-4.1.2-9.15.amzn1.x86_64
Corresponding source RPM to found package : bash-4.1.2-9.15.amzn1.src.rpm

Are these parameters correct? Please type 'yes' to continue:

出来るし・・・
Amazonさんなんとかしてください!(´・ω・`)

共有