Reference: http://www.cnblogs.com/mchina/archive/2013/02/20/2883404.htmlhttp://my.oschina.net/duangr/blog/183160 Set file permissions chown-r Nagios.nagios envision_*chown-r nagios.nagios envision_*
1. Create a user and set a password
# useradd-s/sbin/nologin Nagios
Modify Nagios password sudo passwd nagios password set to Nagios
2. Create a directory and set permissions
# Mkdir/usr/local/nagios
Ls-al--View directory permissions
# Chown-r Nagios.nagios/usr/local/nagios
Ls-al--View directory permissions again mkdir/home/nagios chown-r nagios.nagios/home/nagiossu nagios test mutt send mail, echo "test" |mutt-s "My_first_ Test "[email protected], will automatically wear pieces/home/nagios/sent file
./configure--prefix Effect
If you do not specify prefix, the executable file is placed by default in/usr/local/bin, and the library file is placed by default in/usr/local/lib, and the configuration file is placed by default in/usr/local/etc. Other resource files are placed in the/usr/local/share. You want to uninstall this program, either in the original make directory with the made uninstall (if the make file specified uninstall), or go to the above directory to delete the relevant files by hand.
Specify prefix, delete a folder directly is enough.
3. Download and install
Unzip
TAR-ZXF nagios-4.0.4.tar.gz
Go to the root directory
CD nagios-4.0.4/
Configuration
[Email protected]:~/software/nagios-4.0.4$./configure--prefix=/usr/local/nagios
Configuration
./configure--prefix=/usr/local/nagios
Compile
Make all
Make install && make Install-init && make Install-commandmode && make Install-config
4. Installing the Nagios Plugin
# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz
# tar ZXVF nagios-plugins-1.4.16.tar.gz
# CD nagios-plugins-1.4.16
#./configure--prefix=/usr/local/nagios
# Make && make install
6. Using the Chkconfig Management Service Ubuntu may have bugs with Chkconfig, workaround reference: http://blog.db89.org/ Ubuntu-error-in-the-chkconfig-command-prompt-sbin-insserv-no-such-file-or-directory/sudo ln-s/usr/lib/insserv/ Insserv/sbin/insservr[email protected]:/sbin# Ll/sbin/insserv
lrwxrwxrwx 1 root root 09:21/sbin/insserv-/usr/lib/insserv/insserv*
7.Nagios starts with the following warning:
Starting Nagios:no directory, logging in with home=/
Done.
Modify /etc/passwd
Nagios:x:1001:1001::/home/nagios:/bin/sh instead:
Nagios:x:1001:1001::/usr/local/nagios:/bin/sh
Error:could not open command file '/usr/local/nagios/var/rw/nagios.cmd ' for update!
The permissions on the external command file and/or directory is incorrect. Read the FAQs on what to setup proper permissions.
An error occurred while attempting to commit your command for processing.
Return from whence came question [email protected]:~$ sudo service apache2 restart
* Restarting Web server apache2
Apache2:could not reliably determine the server ' s fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2:could not reliably determine the server ' s fully qualified domain name, using 127.0.1.1 for ServerName
... done. Workaround
Modify the httpd.conf file
Open terminal and enter the following command:
sudo vim/etc/apache2/httpd.conf
By default, this is an empty file that includes the following in the file:
ServerName localhost
Save file exit, restart Apache again, error message No.