NagiosEnterprises / nagioscore

Nagios Core
GNU General Public License v2.0
1.53k stars 445 forks source link

Installation from source not possible #932

Closed gsg-git closed 11 months ago

gsg-git commented 11 months ago

Hello i want to upgrade my installation to the most current version, but it fails at the make step. I tried 4.4.14 and 4.4.13. - both have the same error. I use this guide: https://unihost.com/help/upgrade-nagios-core-to-the-latest-version/ The VM is with Ubuntu Server 22.4. Following strictly the guide when i execute the make all command i get the error: root@nagivis:/tmp/nagios-4.4.13# make all make: *** No rule to make target 'all'. Stop.

The web mentioned the problem could be that the Makerfile.in has tho be renamed to just Makerfile and after this i got a diffrent error:

root@nagivis:/tmp/nagios-4.4.13# sudo make all Makefile:60: *** missing separator. Stop.

In the Makerfile ath line i cant see an issue: CGIDIR=@cgibindir@ LIBEXECDIR=@libexecdir@ LIBDIR=@libdir@ INCLUDEDIR=@includedir@/nagios HTMLDIR=@webdir@ datarootdir=@datarootdir@ LN_S=@LN_S@ INSTALL=@INSTALL@ INSTALL_OPTS=@INSTALL_OPTS@ COMMAND_OPTS=@COMMAND_OPTS@ HTTPD_CONF=@HTTPD_CONF@ LN_HTTPD_SITES_ENABLED=@LN_HTTPD_SITES_ENABLED@ INIT_DIR=@initdir@ INIT_OPTS=@INIT_OPTS@ CGICFGDIR=$(CGIDIR) NAGIOS_USER=@nagios_user@ NAGIOS_GRP=@nagios_grp@ DIST=@dist_type@

SRC_INIT=@src_init@ INIT_FILE=@initname@ INIT_TYPE=@init_type@

USE_EVENTBROKER=@USE_EVENTBROKER@ USE_LIBTAP=@USE_LIBTAP@

CGIEXTRAS=@CGIEXTRAS@

CP=@CP@

The @SET_MAKE@ is the line 60

@SET_MAKE@

none: @echo "Please supply a command line argument (i.e. 'make all'). Other targets are:" @echo " nagios cgis contrib modules workers" @echo " test" @echo " install install-base" @echo " install-cgis install-html" @echo " install-webconf install-config" @echo " install-init install-daemoninit" @echo " install-commandmode install-groups-users" @echo " install-exfoliation install-classicui" @echo " install-basic install-unstripped" @echo " fullinstall"

@echo " uninstall"

    @echo "   clean"

FreeBSD make does not support -C option, so we'll use the Apache style... (patch by Stanley Hopcroft 12/27/1999)

pretty: indent

indent: @sh indent-all.sh

ctags:

Thank you for your help in advance!!

n5047c commented 11 months ago

Hello @gsg-git. Did you run ./configure script? Do you have config.log file? It must end with something like this:

*** Configuration summary for nagios 4.4.14 2023-08-01 ***:

 General Options:
 -------------------------
        Nagios executable:  nagios
        Nagios user/group:  nagios,nagios
       Command user/group:  nagios,nagios
             Event Broker:  yes
        Install ${prefix}:  /usr/local/nagios
    Install ${includedir}:  /usr/local/nagios/include/nagios
                Lock file:  /run/nagios.lock
   Check result directory:  /usr/local/nagios/var/spool/checkresults
           Init directory:  /lib/systemd/system
  Apache conf.d directory:  /etc/httpd/conf.d
             Mail program:  /bin/mail
                  Host OS:  linux-gnu
          IOBroker Method:  epoll

 Web Interface Options:
 ------------------------
                 HTML URL:  http://localhost/nagios/
                  CGI URL:  http://localhost/nagios/cgi-bin/
 Traceroute (used by WAP):  /usr/sbin/traceroute

Review the options above for accuracy.  If they look okay,
type 'make all' to compile the main program and CGIs.

And after that you can use 'make all'

gsg-git commented 11 months ago

Hello @n5047c , i followed the guide exactly with the script.

Because of the errors for not reaching system components like socket.h T tested it with a c program and building and executing is possible:

#include <sys/socket.h>
#include <stdio.h>

int main() {
    printf("sys/socket.h ist verfügbar!\n");
    return 0;
}

grafik

The only change it does compared to the defauld Makefile,in is in the last line:

# Targets that always get built
.PHONY: indent clean distclean dox test html
.PHONY: indent clean clean distclean dox test html (Default)

I added the logfile.

I found something in the web about necessary libdc-dev, but i have the package aleready installed.

Thank younfor your time!

config.log

n5047c commented 11 months ago

Hello @gsg-git.

I tried use docker image ubuntu 22.04. Then I installed gcc, make and libssl-dev:

apt install gcc make libssl-dev

After I run configure:

./configure --with-command-group=nagcmd

and got successful result. config.log

gsg-git commented 11 months ago

Hello @n5047c , how do i see in the log that everything was successfull? In your log there seem the same errors as in mine. And the problem is not running the script, but to build after it.

So i think it would be rather interesting what happens if you execute "make all".

n5047c commented 11 months ago

Hello @gsg-git.

Yes, in my log the same errors, but there are 2 sections in it that are different.

configure:9383: result: *** Configuration summary for nagios 4.4.14 2023-08-01 ***:
configure:9390: result:         Nagios executable:  nagios
configure:9392: result:         Nagios user/group:  nagios,nagios
configure:9394: result:        Command user/group:  nagios,nagcmd
configure:9396: result:              Event Broker:  yes
configure:9398: result:         Install ${prefix}:  /usr/local/nagios
configure:9400: result:     Install ${includedir}:  /usr/local/nagios/include/nagios
configure:9402: result:                 Lock file:  /run/nagios.lock
configure:9404: result:    Check result directory:  /usr/local/nagios/var/spool/checkresults
configure:9406: result:            Init directory:  /etc/init.d
configure:9408: result:   Apache conf.d directory:  /etc/httpd/conf.d
configure:9410: result:              Mail program:  /bin/mail
configure:9412: result:                   Host OS:  linux-gnu
configure:9414: result:           IOBroker Method:  epoll
configure:9421: result:                  HTML URL:  http://localhost/nagios/
configure:9423: result:                   CGI URL:  http://localhost/nagios/cgi-bin/
configure:9425: result:  Traceroute (used by WAP):

and last line:

configure: exit 0

When you get the same result, then you may execute "make all".

gsg-git commented 11 months ago

Hello @n5047c, i am now a little further. I needed two applications openssl libssl-dev and unzip In the guide for the Upgrade there wasnt the libssl-dev mentioned and because i used apt for the basic Installation it propably wasnt included.

The path isnt correct - apt installed nagios by default in nagios4 - even http://IP/nagios4. My installation is still without data so i can change to the better Nagios default namechemes.

 *** Configuration summary for nagios 4.4.14 2023-08-01 ***:

 General Options:
 -------------------------
        Nagios executable:  nagios
        Nagios user/group:  nagios,nagios
       Command user/group:  nagios,nagcmd
             Event Broker:  yes
        Install ${prefix}:  /usr/local/nagios
    Install ${includedir}:  /usr/local/nagios/include/nagios
                Lock file:  /run/nagios.lock
   Check result directory:  /usr/local/nagios/var/spool/checkresults
           Init directory:  /lib/systemd/system
  Apache conf.d directory:  /etc/apache2/conf.d
             Mail program:  /usr/bin/mail
                  Host OS:  linux-gnu
          IOBroker Method:  epoll

 Web Interface Options:
 ------------------------
                 HTML URL:  http://localhost/nagios/
                  CGI URL:  http://localhost/nagios/cgi-bin/
 Traceroute (used by WAP):

Review the options above for accuracy.  If they look okay,
type 'make all' to compile the main program and CGIs.

Its now compiling!

Thank you Roenko!!

gsg-git commented 11 months ago

Hello @n5047c, now the installation failed:

/usr/bin/install: invalid group ‘nagcmd’
make[1]: *** [Makefile:293: install-basic] Error 1
make[1]: Leaving directory '/tmp/nagios-4.4.14'
make: *** [Makefile:280: install] Error 2

Can i start the installtaion again or do i have to build again after bugfixing?

Thank you!

n5047c commented 11 months ago

Hello @gsg-git.

  1. You can create the required group nagcmd (groupadd -r nagcmd) and may continue installation.
  2. You can use default group (nagios) and run configure command again without any options: ./configure and make/install again:
    make all
    make install-groups-users
    make install
    
gsg-git commented 11 months ago

@n5047c thank you!

I have the Nagios now up and running. There schould be a hint in the web if you want to use nagios longer you shold install directly from source and forget about apt in ubuntu.