Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm unable to build RPM w/ nagios 3.5.0 (last one that worked for me was 3.2.3):

# md5sum nagios-3.5.0.tar.gz 
aeef195d2033cc362bf6cb972bcc8f07  nagios-3.5.0.tar.gz
# rpmbuild -tb nagios-3.5.0.tar.gz 
warning: line 40: prereq is deprecated: PreReq: /usr/bin/logger, chkconfig, sh-utils, shadow-utils, sed, initscripts, fileutils, mktemp
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.VOVWNc
+ umask 022
+ cd /root/rpmbuild/BUILD
+ export LANG
+ unset DISPLAY
+ cd /root/rpmbuild/BUILD
+ rm -rf nagios-3.5.0
+ /usr/bin/gzip -dc /root/nagios-3.5.0.tar.gz
+ /bin/tar -xf -
+ '[' 0 -ne 0 ']'
+ cd nagios-3.5.0
/var/tmp/rpm-tmp.VOVWNc: line 38: cd: nagios-3.5.0: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.VOVWNc (%prep)

RPM build errors:
    line 40: prereq is deprecated: PreReq: /usr/bin/logger, chkconfig, sh-utils, shadow-utils, sed, initscripts, fileutils, mktemp
    Bad exit status from /var/tmp/rpm-tmp.VOVWNc (%prep)
# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.4 (Santiago)
# uname -a
Linux XXX.XXX.XXX 2.6.32-358.6.2.el6.x86_64 #1 SMP Tue May 14 15:48:21 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
# rpm -q rpm-build

Any ideas/suggestions?

share|improve this question
Yes: Use a repo that packages this stuff, like EPEL. – Sven Jul 24 '13 at 14:01
@SvW while your comment doesn't really answer my question at all, I do appreciate your suggestion, yet I still would like to know what's wrong in my scenario. and for all downvoters: PLEASE explain why are you downvoting (w/out your comments I can't improve myself). – alexus Jul 24 '13 at 14:04
I suspect that people are downvoting your question because you're getting some pretty obvious error messages. It's entirely possible that the spec file in the nagios tarball is simply unmaintained. It's apparent from the errors that the spec file no longer corresponds to how Nagios is packaged. – larsks Jul 24 '13 at 14:13
@larsks right and I'm here to find a solution, as I couldn't figure it out by myself, I'm sure someone else ran into same situation here and there and I'm hoping they'll share their valuable experience w/ rest of open source community). – alexus Jul 24 '13 at 14:15
Your solution is to grab the EPEL source rpm and modify it to fit your needs. The spec file included in the nagios tarball is obviously unmaintained and no longer compatible with either your OS release or the Nagios package itself. You could of course also write a spec file from scratch, and that's a valuable skill to learn but not particularly relevant to this question. – larsks Jul 24 '13 at 14:27

As you said above the issue is that spec file is no more maintained

# zcat nagios-3.5.0.tar.gz | tar -tf - | head -3

As you can see, the folder name is nagios, but in the spec file it's try to change dir to the nagios-3.5.0

+ cd nagios-3.5.0

If you can't use 3rd party repo such as EPEL, I will suggest to take spec file from and build your own package

share|improve this answer
up vote 1 down vote accepted

Nagios (rpmbuild) Enterprise Linux | alexus' blog

tar -zxf nagios-3.5.0.tar.gz
rm nagios-3.5.0.tar.gz
mv nagios nagios-3.5.0
sed -i 's/datarootdir/datadir/' nagios-3.5.0/nagios.spec
tar -czf nagios-3.5.0.tar.gz nagios-3.5.0
rpmbuild -tb nagios-3.5.0.tar.gz
ls rpmbuild/RPMS/*/nagios-3.5.0*rpm
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.