How To Install Centreon On Debian Jessie
This tutorial shows how to install a Debian 8 (Jessie) minimal server. The purpose of this guide is to provide a minimal Debian setup that can be used as the basis for our other Debian 8 tutorials and the perfect server guides here at Kreationnext.com.
1 Requirements
To install a Debian 8 server system you will need the following:
- the Debian Jessie network installation CD, available here:
32Bit: http://cdimage.debian.org/debian-cd/8.1.0/i386/iso-cd/debian-8.1.0-i386-netinst.iso (i386) or
64Bit: http://cdimage.debian.org/debian-cd/8.1.0/amd64/iso-cd/debian-8.0.0-amd64-netinst.iso (x86_64 / amd64) - a fast Internet connection.
I will use the 64Bit installation media here.
2 Preliminary Note
How to install Nagios 4.2.0 (Debian 8) Posted on by Ruben Carbonell There are some places where the next process is explained, but since I’ve pending an article explaining how to configure Nagios Server with nsca-ng I’ve been thinking in post first an easy steps to configure Nagios from scratch.
In this tutorial, I will use the hostname server1.example.com with the IP address 192.168.1.100 and the gateway 192.168.1.1. These settings might differ for you, so you have to replace them where appropriate.
3 The Debian Base System
Insert your Debian 8 (Jessie) network installation CD into your system and boot from it. When you use a virtualisation software like VMware or Virtualbox, then select the Debian Jessie minimal iso file as source file for the DVD drive of the VM, you don’t have to burn it to a CD or DVD for that first.
Select Install (this will start the text installer – if you prefer a graphical installer, select Graphical install):
How To Install Centreon
Select your language:
Then choose your location:
Choose a keyboard layout:
The installer checks the installation CD, your hardware and configures the network with DHCP if there is a DHCP server in the network:
Enter the hostname. In this example, my system is called server1.example.com, so I enter server1:
Enter your domain name. In this example, this is example.com:
Afterward, give the root user a password:
Confirm that password to avoid typos:
Create a Linux user account, e.g. your name or nickname. For this example installation, I will choose the name “administrator” with the user name administrator (don’t use the user name admin as it is a reserved name on Debian Linux):
Create a Linux user account, e.g. your name or nickname. For this example installation, I will choose the name “administrator” with the user name administrator (don’t use the user name admin as it is a reserved name on Debian Linux):
Now select the timezone for the server
Now you have to partition your hard disk. For simplicity’s sake I select Guided – use entire disk – this will create a large partition for the / file system and another one for swap (of course, the partitioning is totally up to you – if you know what you’re doing, you can also set up your partitions manually). For hosting systems like the ISPConfig 3 perfect server tutorials you might want to choose e.g. 20GB for / and a large /var partition as all website and email data is stored in subdirectories of /var.
Select the disk that you want to partition:
Then select the partitioning scheme. As mentioned before, I select All files in one partition (recommended for new users) for simplicity’s sake – it’s up to your likings what you choose here:
When you’re finished, select Finish partitioning and write changes to disk:
Select Yes when you’re asked: “Write changes to disk?”:
Afterward, your new partitions are created and formatted. Now the base system is installed:
Next you must configure apt. Because we are using the Debian Jessie Netinstall CD, which contains only a minimal set of packages, we must use a network mirror. Select the country where the network mirror that you want to use is located (usually this is the country where your Server system is located):
Then select the mirror you wish to use (e.g. ftp.us.debian.org):
Unless you use an HTTP proxy, leave the following field empty and hit Continue:
Apt is now updating its packages database:
You can skip the package usage survey by selecting No:
You can skip the package usage survey by selecting No:
We just select Standard system utilities and SSH server (so that I can immediately connect to the system with an SSH client such as PuTTY after the installation has finished) and hit Continue.
Some might argue that one should not install the Standard System Utilities on a minimal server but in my opinion, you will need most of the standard utilities later anyway so I will install them on this server as part of the base setup.
The required packages are downloaded and installed on the system:
When you’re asked Install the GRUB boot loader to the master boot record?, select Yes:
The installer might ask you in which partition Grub shall be installed. This server has just one harddisk, so I choose /dev/sda here.
Press enter and the Installer will install Grub and finishes the installation.
The base system installation is now finished. Remove the Debian Netinstall CD from the CD drive and hit Continue to reboot the system:
The first boot of the newly installed Debian 8 server: first you will see the boot screen of the Grub Boot Loader, press enter or wait a few seconds, the boot process will continue automatically.
A few seconds later the login prompt should show up.
Login with username “root” and the root password that you have chosen during installation. When you login by SSH, then use the username “administrator” as the root user is disabled for remote logins. Then run the command “su”:
su
To become root user.
On to the next step…
4 Install The SSH Server (Optional)
If you did not install the OpenSSH server during the system installation, you could do it now:
apt-get -y install ssh openssh-server
From now on you can use an SSH client such as PuTTY and connect from your workstation to your Debian Jessie server and follow the remaining steps from this tutorial.
5 Install a shell editor (Optional)
I’ll use nano as my favorite shell text editor, others prefer vi that is not that easy to use for beginners. With the following command I will install both editors:
apt-get -y install vim-nox nano
(You don’t have to do this if you use a different text editor such as joe or the built-in editor from mc).
6 Configure The Network
Because the Debian 8 installer has configured our system to get its network settings via DHCP, we have to change that now because a server should have a static IP address. Edit /etc/network/interfaces and adjust it to your needs (in this example setup I will use the IP address 192.168.1.100) (please note that I replace allow-hotplug eth0 with auto eth0; otherwise restarting the network doesn’t work, and we’d have to reboot the whole system):
nano /etc/network/interfaces
The interfaces file with DHCP enabled as created by the apt installer:
And here the edited interfaces file with the static IP 192.168.1.100 configured.
Then restart your network:
service networking restart
Then edit /etc/hosts. Make it look like this:
nano /etc/hosts
Now edit the hostname in case you did not select the final hostname in the installer
nano /etc/hostname
The /etc/hostname file contains the hostname without the domain part, so in our case just “server1”.
Then reboot the server to apply the hostname change:
reboot
After you logged in again, run:
hostname
hostname -f
To verify that the new hostname is set correctly. The outut should be:
root@server1:/home/administrator# hostname
server1
root@server1:/home/administrator# hostname -f
server1.example.com
root@server1:/home/administrator#
7 Update Your Debian Installation
First make sure that your /etc/apt/sources.list contains the jessie/updates repository (this makes sure you always get the newest updates), and that the contrib and non-free repositories are enabled.
nano /etc/apt/sources.list
Run
apt-get update
to update the apt package database and
apt-get upgrade
to install the latest updates (if there are any).
8 Links
- Debian: http://www.debian.org/
Comments
comments
Related
Introduction
In this tutorial, we will cover the installation of Nagios 4, a very popular open source monitoring system, on Ubuntu 14.04. We will cover some basic configuration, so you will be able to monitor host resources via the web interface. We will also utilize the Nagios Remote Plugin Executor (NRPE), that will be installed as an agent on remote hosts, to monitor their local resources.
Nagios is useful for keeping an inventory of your servers, and making sure your critical services are up and running. Using a monitoring system, like Nagios, is an essential tool for any production server environment.
Prerequisites
To follow this tutorial, you must have superuser privileges on the Ubuntu 14.04 server that will run Nagios. Ideally, you will be using a non-root user with superuser privileges. If you need help setting that up, follow the steps 1 through 3 in this tutorial: Initial Server Setup with Ubuntu 14.04.
A LAMP stack is also required. Follow this tutorial if you need to set that up: How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 14.04.
This tutorial assumes that your server has private networking enabled. If it doesn’t, just replace all the references to private IP addresses with public IP addresses.
Now that we have the prerequisites sorted out, let’s move on to getting Nagios 4 installed.
Install Nagios 4
This section will cover how to install Nagios 4 on your monitoring server. You only need to complete this section once.
Create Nagios User and Group
We must create a user and group that will run the Nagios process. Create a “nagios” user and “nagcmd” group, then add the user to the group with these commands:
How To Install Centreon On Debian Jessie J
Install Build Dependencies
Because we are building Nagios Core from source, we must install a few development libraries that will allow us to complete the build. While we’re at it, we will also install apache2-utils
, which will be used to set up the Nagios web interface.
First, update your apt-get package lists:
Then install the required packages:
Let’s install Nagios now.
Install Nagios Core
Download the source code for the latest stable release of Nagios Core. Go to the Nagios downloads page, and click the Skip to download link below the form. Copy the link address for the latest stable release so you can download it to your Nagios server.
At the time of this writing, the latest stable release is Nagios 4.1.1. Download it to your home directory with curl:
Extract the Nagios archive with this command:
Then change to the extracted directory:
Before building Nagios, we must configure it. If you want to configure it to use postfix (which you can install with apt-get), add --with-mail=/usr/sbin/sendmail
to the following command:
Now compile Nagios with this command:
Now we can run these make commands to install Nagios, init scripts, and sample configuration files:
In order to issue external commands via the web interface to Nagios, we must add the web server user, www-data
, to the nagcmd
group:
Install Nagios Plugins
Find the latest release of Nagios Plugins here: Nagios Plugins Download. Copy the link address for the latest version, and copy the link address so you can download it to your Nagios server.
At the time of this writing, the latest version is Nagios Plugins 2.1.1. Download it to your home directory with curl:
Extract Nagios Plugins archive with this command:
Then change to the extracted directory:
Before building Nagios Plugins, we must configure it. Use this command:
Now compile Nagios Plugins with this command:
Then install it with this command:
Install NRPE
Find the source code for the latest stable release of NRPE at the NRPE downloads page. Download the latest version to your Nagios server.
At the time of this writing, the latest release is 2.15. Download it to your home directory with curl:
Extract the NRPE archive with this command:
Then change to the extracted directory:
Configure NRPE with these commands:
Now build and install NRPE and its xinetd startup script with these commands:
Open the xinetd startup script in an editor:
Modify the only_from
line by adding the private IP address of the your Nagios server to the end (substitute in the actual IP address of your server):
Save and exit. Only the Nagios server will be allowed to communicate with NRPE.
Restart the xinetd service to start NRPE:
Now that Nagios 4 is installed, we need to configure it.
Configure Nagios
Now let’s perform the initial Nagios configuration. You only need to perform this section once, on your Nagios server.
Organize Nagios Configuration
Open the main Nagios configuration file in your favorite text editor. We’ll use vi to edit the file:
Now find an uncomment this line by deleting the #
:
Save and exit.
Now create the directory that will store the configuration file for each server that you will monitor:
Configure Nagios Contacts
How To Install Centreon On Debian Jessie James Decker
Open the Nagios contacts configuration in your favorite text editor. We’ll use vi to edit the file:
Find the email directive, and replace its value (the highlighted part) with your own email address:
Save and exit.
Configure check_nrpe Command
Let’s add a new command to our Nagios configuration:
Add the following to the end of the file:
Save and exit. This allows you to use the check_nrpe
command in your Nagios service definitions.
Configure Apache
Enable the Apache rewrite and cgi modules:
Use htpasswd to create an admin user, called “nagiosadmin”, that can access the Nagios web interface:
Enter a password at the prompt. Remember this password, as you will need it to access the Nagios web interface.
Note: If you create a user that is not named “nagiosadmin”, you will need to edit /usr/local/nagios/etc/cgi.cfg
and change all the “nagiosadmin” references to the user you created.
Now create a symbolic link of nagios.conf
to the sites-enabled
directory:
Nagios is ready to be started. Let’s do that, and restart Apache:
To enable Nagios to start on server boot, run this command:
Optional: Restrict Access by IP Address
If you want to restrict the IP addresses that can access the Nagios web interface, you will want to edit the Apache configuration file:
Find and comment the following two lines by adding #
symbols in front of them:
Then uncomment the following lines, by deleting the #
symbols, and add the IP addresses or ranges (space delimited) that you want to allow to in the Allow from
line:
As these lines will appear twice in the configuration file, so you will need to perform these steps once more.
Save and exit.
Now restart Apache to put the change into effect:
Nagios is now running, so let’s try and log in.
Accessing the Nagios Web Interface
Open your favorite web browser, and go to your Nagios server (substitute the IP address or hostname for the highlighted part):
Because we configured Apache to use htpasswd, you must enter the login credentials that you created earlier. We used “nagiosadmin” as the username:
After authenticating, you will be see the default Nagios home page. Click on the Hosts link, in the left navigation bar, to see which hosts Nagios is monitoring:
As you can see, Nagios is monitoring only “localhost”, or itself.
Let’s monitor another host with Nagios!
Monitor a Host with NRPE
In this section, we’ll show you how to add a new host to Nagios, so it will be monitored. Repeat this section for each server you wish to monitor.
On a server that you want to monitor, update apt-get:
Now install Nagios Plugins and NRPE:
Configure Allowed Hosts
Now, let’s update the NRPE configuration file. Open it in your favorite editor (we’re using vi):
Find the allowed_hosts
directive, and add the private IP address of your Nagios server to the comma-delimited list (substitute it in place of the highlighted example):
Save and exit. This configures NRPE to accept requests from your Nagios server, via its private IP address.
Configure Allowed NRPE Commands
Look up the name of your root filesystem (because it is one of the items we want to monitor):
We will be using the filesystem name in the NRPE configuration to monitor your disk usage (it is probably /dev/vda
). Now open nrpe.cfg for editing:
The NRPE configuration file is very long and full of comments. There are a few lines that you will need to find and modify:
- server_address: Set to the private IP address of this host
- allowed_hosts: Set to the private IP address of your Nagios server
- command[check_hda1]: Change
/dev/hda1
to whatever your root filesystem is called
The three aforementioned lines should look like this (substitute the appropriate values):
Note that there are several other “commands” defined in this file that will run if the Nagios server is configured to use them. Also note that NRPE will be listening on port 5666 because server_port=5666
is set. If you have any firewalls blocking that port, be sure to open it to your Nagios server.
Save and quit.
Restart NRPE
Restart NRPE to put the change into effect:
Once you are done installing and configuring NRPE on the hosts that you want to monitor, you will have to add these hosts to your Nagios server configuration before it will start monitoring them.
Add Host to Nagios Configuration
On your Nagios server, create a new configuration file for each of the remote hosts that you want to monitor in /usr/local/nagios/etc/servers/
. Replace the highlighted word, “yourhost”, with the name of your host:
Add in the following host definition, replacing the host_name
value with your remote hostname (“web-1” in the example), the alias
value with a description of the host, and the address
value with the private IP address of the remote host:
With the configuration file above, Nagios will only monitor if the host is up or down. If this is sufficient for you, save and exit then restart Nagios. If you want to monitor particular services, read on.
Add any of these service blocks for services you want to monitor. Note that the value of check_command determines what will be monitored, including status threshold values. Here are some examples that you can add to your host’s configuration file:
Ping:
SSH (notifications_enabled set to 0 disables notifications for a service):
If you’re not sure what use generic-service
means, it is simply inheriting the values of a service template called “generic-service” that is defined by default.
Now save and quit. Reload your Nagios configuration to put any changes into effect:
Once you are done configuring Nagios to monitor all of your remote hosts, you should be set. Be sure to access your Nagios web interface, and check out the Services page to see all of your monitored hosts and services:
Conclusion
Now that you monitoring your hosts and some of their services, you might want to spend some time to figure out which services are critical to you, so you can start monitoring those. You may also want to set up notifications so, for example, you receive an email when your disk utilization reaches a warning or critical threshold or your main website is down, so you can resolve the situation promptly or before a problem even occurs.
Good luck!