LoginSignup
3
3

More than 5 years have passed since last update.

Zabbix 3.0.0 Release CentOS6のRPMファイル作成

Last updated at Posted at 2016-02-18

#CentOS6用のrpmがない
※CentOS5,CentOS6のRPMがリリースされたようです。
http://repo.zabbix.com/zabbix/3.0/rhel/5/x86_64/zabbix-release-3.0-1.el5.noarch.rpm
http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm

まぁ、そのうちReleaseされると思いますが、お勉強のためにRPMファイルを作ってみる
それとも、Releaseされないのかな・・・・
Agentは配布されているようだが、こちらもrpmは無いのか
Zabbix 2.4のSPECファイルでは、Configureでopensslの有効化などが行われていないので3.0のSPECファイルを修正する方が楽そう

RPM Build環境の作成

OS:CentOS6
パッケージが作成できたら破棄するので適当にGroup InstallとBuildに必要なdevelをインストール

$ sudo yum -y groupinstall "Development Tools"
$ sudo yum -y localinstall \
> http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

$ sudo yum -y install mysql-devel postgresql-devel net-snmp-devel \
> openldap-devel gnutls-devel iksemel-devel sqlite-devel unixODBC-devel \
> curl-devel OpenIPMI-devel libssh2-devel java-devel libxml2-devel

CentOS7用のSrcファイルをダウンロード&展開

$ curl -O http://repo.zabbix.com/zabbix/3.0/rhel/7/SRPMS/zabbix-3.0.0-1.el7.src.rpm
$ rpm -ivh zabbix-3.0.0-1.el7.src.rpm
$ ls 
rpmbuild  zabbix-3.0.0-1.el7.src.rpm

SPECファイルの修正

CentOS6で展開する気が無いのか、色々と・・・
rpmbuildでエラーになる原因は下記の2つ

  • CentOS7でしか展開されていないzabbix_java_gateway_logback.xmlをチェックしている。
$ diff -u rpmbuild/SPECS/zabbix.spec.org rpmbuild/SPECS
/zabbix.spec.1
--- rpmbuild/SPECS/zabbix.spec.org      2016-02-15 16:09:47.000000000 +0000
+++ rpmbuild/SPECS/zabbix.spec.1        2016-02-18 08:30:18.775997138 +0000
@@ -950,10 +950,10 @@
 %defattr(-,root,root,-)
 %doc AUTHORS ChangeLog COPYING NEWS README
 %config(noreplace) %{_sysconfdir}/zabbix/zabbix_java_gateway.conf
-%config(noreplace) %{_sysconfdir}/zabbix/zabbix_java_gateway_logback.xml
 %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/log/zabbix
 %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix
 %if 0%{?rhel} >= 7
+%config(noreplace) %{_sysconfdir}/zabbix/zabbix_java_gateway_logback.xml
 %{_datadir}/zabbix-java-gateway
 %{_sbindir}/zabbix_java_gateway
 %{_unitdir}/zabbix-java-gateway.service

(必須ならば、違う部分の修正になるな)

  • AUTHORS ChangeLog COPYING NEWS READMEを各rpmに添付しようとしている。 他のdocumentが削除される
$ diff -u rpmbuild/SPECS/zabbix.spec.1 rpmbuild/SPECS/z
abbix.spec
--- rpmbuild/SPECS/zabbix.spec.1        2016-02-18 08:30:18.775997138 +0000
+++ rpmbuild/SPECS/zabbix.spec  2016-02-18 08:34:05.364000110 +0000
@@ -821,9 +821,15 @@
 %endif
 %endif

-%files agent
+%files
 %defattr(-,root,root,-)
 %doc AUTHORS ChangeLog COPYING NEWS README
+%dir %{_sysconfdir}/zabbix
+%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/log/zabbix
+%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix
+
+%files agent
+%defattr(-,root,root,-)
 %{_docdir}/zabbix-agent-%{version}/
 %config(noreplace) %{_sysconfdir}/zabbix/zabbix_agentd.conf
 %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix-agent
@@ -843,20 +849,17 @@

 %files get
 %defattr(-,root,root,-)
-%doc AUTHORS ChangeLog COPYING NEWS README
 %{_bindir}/zabbix_get
 %{_mandir}/man1/zabbix_get.1*

 %files sender
 %defattr(-,root,root,-)
-%doc AUTHORS ChangeLog COPYING NEWS README
 %{_bindir}/zabbix_sender
 %{_mandir}/man1/zabbix_sender.1*

 %if %{build_server}
 %files server-mysql
 %defattr(-,root,root,-)
-%doc AUTHORS ChangeLog COPYING NEWS README
 %{_docdir}/zabbix-server-mysql-%{version}/
 %attr(0640,root,zabbix) %config(noreplace) %{_sysconfdir}/zabbix/zabbix_server.conf
 %dir /usr/lib/zabbix/alertscripts
@@ -875,7 +878,6 @@

 %files server-pgsql
 %defattr(-,root,root,-)
-%doc AUTHORS ChangeLog COPYING NEWS README
 %{_docdir}/zabbix-server-pgsql-%{version}/
 %attr(0640,root,zabbix) %config(noreplace) %{_sysconfdir}/zabbix/zabbix_server.conf
 %dir /usr/lib/zabbix/alertscripts
@@ -894,7 +896,6 @@

 %files proxy-mysql
 %defattr(-,root,root,-)
-%doc AUTHORS ChangeLog COPYING NEWS README
 %{_docdir}/zabbix-proxy-mysql-%{version}/
 %attr(0640,root,zabbix) %config(noreplace) %{_sysconfdir}/zabbix/zabbix_proxy.conf
 %dir /usr/lib/zabbix/externalscripts
@@ -912,7 +913,6 @@

 %files proxy-pgsql
 %defattr(-,root,root,-)
-%doc AUTHORS ChangeLog COPYING NEWS README
 %{_docdir}/zabbix-proxy-pgsql-%{version}/
 %attr(0640,root,zabbix) %config(noreplace) %{_sysconfdir}/zabbix/zabbix_proxy.conf
 %dir /usr/lib/zabbix/externalscripts
@@ -930,7 +930,6 @@

 %files proxy-sqlite3
 %defattr(-,root,root,-)
-%doc AUTHORS ChangeLog COPYING NEWS README
 %{_docdir}/zabbix-proxy-sqlite3-%{version}/
 %attr(0640,root,zabbix) %config(noreplace) %{_sysconfdir}/zabbix/zabbix_proxy.conf
 %dir /usr/lib/zabbix/externalscripts
@@ -948,7 +947,6 @@

 %files java-gateway
 %defattr(-,root,root,-)
-%doc AUTHORS ChangeLog COPYING NEWS README
 %config(noreplace) %{_sysconfdir}/zabbix/zabbix_java_gateway.conf
 %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/log/zabbix
 %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix
@@ -965,7 +963,6 @@

 %files web
 %defattr(-,root,root,-)
-%doc AUTHORS ChangeLog COPYING NEWS README
 %dir %attr(0750,apache,apache) %{_sysconfdir}/zabbix/web
 %ghost %attr(0644,apache,apache) %config(noreplace) %{_sysconfdir}/zabbix/web/zabbix.conf.php
 %config(noreplace) %{_sysconfdir}/zabbix/web/maintenance.inc.php

修正ができたらBuild

$ rpmbuild -bb rpmbuild/SPECS/zabbix.spec
$ ls rpmbuild/RPMS/*
rpmbuild/RPMS/noarch:
zabbix-web-3.0.0-1.el6.noarch.rpm
zabbix-web-japanese-3.0.0-1.el6.noarch.rpm
zabbix-web-mysql-3.0.0-1.el6.noarch.rpm
zabbix-web-pgsql-3.0.0-1.el6.noarch.rpm

rpmbuild/RPMS/x86_64:
zabbix-3.0.0-1.el6.x86_64.rpm
zabbix-agent-3.0.0-1.el6.x86_64.rpm
zabbix-debuginfo-3.0.0-1.el6.x86_64.rpm
zabbix-get-3.0.0-1.el6.x86_64.rpm
zabbix-java-gateway-3.0.0-1.el6.x86_64.rpm
zabbix-proxy-mysql-3.0.0-1.el6.x86_64.rpm
zabbix-proxy-pgsql-3.0.0-1.el6.x86_64.rpm
zabbix-proxy-sqlite3-3.0.0-1.el6.x86_64.rpm
zabbix-sender-3.0.0-1.el6.x86_64.rpm
zabbix-server-mysql-3.0.0-1.el6.x86_64.rpm
zabbix-server-pgsql-3.0.0-1.el6.x86_64.rpm 

出来上がり
zabbix-webのインストールでは、PHP5.4が必須となるのでremi repoあたりからインストールが必要
(標準でCentOS6がPHP5.4に対応していないから外されているのかな?)

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3