0

我正在创建自己的 Nagios RPM,但我是包装新手。我的 RPM 文件创建成功,我可以安装它。

去 localhost/nagios 时,我无法登录。

这是我的规格文件

%define debug_package %{nil}
%define _prefix /usr/local/nagios
%define _install /usr/bin/install
%define _httpdconf /etc/httpd/conf.d
%define _libexecdir /usr/local/nagios/libexec
%define _logdir /usr/local/nagios/var
%define _checkresultdir /usr/local/nagios/var/spool/checkresults

Summary: Nagios blabla
Name: nagios
Version: 1
Release: 1
License: PROPRIETARY
Group: Applications/Accessories
Source: nagios-1.tar.gz
Packager: Nicholas Lievens <lievens.nicholas@gmail.com>
AutoReqProv: no
Requires: gcc gcc-c++ glibc glibc-common glibc-devel gd gd-devel php53 php53-cli php53-mysql php53-gd php53-pdo graphviz httpd libdbi-dbd-mysql libdbi-devel mysql mysql-server mysql-devel git

%description
Nagios!
%prep
%setup
%build
./configure --with-init-dir=/etc/init.d \
--with-cgiurl=/nagios/cgi-bin \
--with-htmurl=/nagios \
--with-lockfile=/var/run/nagios.pid \
--with-nagios-user=nagios \
--with-nagios-group=nagios \
--prefix=%{_prefix} \
--exec-prefix=%{_prefix}/sbin \
--bindir=%{_prefix}/sbin \
--sbindir=%{_prefix}/sbin \
--libexecdir=%{_prefix}/libexec \
--datadir=%{_prefix}/share/nagios \
--sysconfdir=/etc/nagios \
--localstatedir=/var/log/nagios
make all
%install
make install
make install-init
make install-config
make install-commandmode
make install-webconf
make install-devel

htpasswd -b -c /usr/local/nagios/etc/htpasswd.users nagiosadmin nagiosadmin

install -d -m 0775 ${RPM_BUILD_ROOT}/var/spool/nagios
install -d -m 0755 ${RPM_BUILD_ROOT}%{_prefix}/include/nagios
install -d -m 0755 ${RPM_BUILD_ROOT}/etc/init.d
install -d -m 0755 ${RPM_BUILD_ROOT}/etc/logrotate.d
install -d -m 0755 ${RPM_BUILD_ROOT}/etc/httpd/conf.d
install -d -m 0755 ${RPM_BUILD_ROOT}%{_prefix}/etc
install -d -m 0755 ${RPM_BUILD_ROOT}%{_prefix}/etc
%files
/etc/init.d/nagios
%{_prefix}/var
%{_prefix}/var/spool/checkresults
%{_prefix}/etc
%{_prefix}/bin
%{_prefix}/sbin
%{_prefix}/libexec
%{_prefix}/lib
%{_prefix}/include/nagios
%{_prefix}/share
%{_prefix}/etc
/etc/nagios
/etc/nagios/objects
%defattr(755,nagios,nagios)
/var/log/nagios
/var/log/nagios/archives
%defattr(2775,nagios,nagios)
/var/spool/nagios
###%files www
%defattr(755,root,root)
%{_prefix}/sbin
%{_prefix}/sbin/*
%{_prefix}/share/nagios
%defattr(-,root,root)
%{_prefix}/share/nagios/*
%config(noreplace) /etc/httpd/conf.d/nagios.conf

我可能会丢失一些文件来正确运行 nagios,但正如我所说我没有这方面的经验,所以如果有人知道更多...... Thx

--编辑查看日志文件时出现错误:错误:无法打开外部命令文件以通过 open():(13) 读取 -> 权限被拒绝

似乎我必须 chmod 一些东西,但是什么?

4

1 回答 1

0

当您说您无法登录时,您能更具体一点吗?

对于初学者,我会添加一个apachectl condrestartto%post%postun确保httpd重新加载您放入的配置文件。

有什么权限/etc/httpd/conf.d/nagios.conf?您是否必须在该文件上修复 SELinux 上下文?

于 2013-05-15T09:34:54.573 回答