How To Install Zabbix on Ubuntu 12.04 Precise & Configure

Hello –

Today, I am going to show how you can install zabbix monitoring tool on Ubuntu 12.04 Precise.

Edit apt source list to add the PPA:

sudo nano /etc/apt/sources.list

Add the following items at the end of the file:

# Zabbix Application PPA

deb http://ppa.launchpad.net/tbfr/zabbix/ubuntu precise main
deb-src http://ppa.launchpad.net/tbfr/zabbix/ubuntu precise main

Save and close the file.

Next, we need to add the PPA’s key so that apt-get trusts the source:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C407E17D5F76A32B

We can now install Zabbix. It will pull in the necessary LAMP dependencies as well:

sudo apt-get update
sudo apt-get install zabbix-server-mysql apache2 mysql-server php5 php5-cli php5-common php5-mysql zabbix-frontend-php

During the installation, you will be asked to choose a password for the MySQL root account. Make a selection and confirm your choice.

Configuring the Zabbix Server
Next, we will need to configure the packages we just installed.

First, we will edit the main Zabbix server configuration file. Open the file with root privileges:

sudo nano /etc/zabbix/zabbix_server.conf

Search for the following properties and set them accordingly. Some may already be set correctly, and some you may have to add. Choose a password as well:

DBName=zabbix
DBUser=zabbix
DBPassword=Your.Password.Here
Save and close the file.

MySQL Configuration
Next, we will go into the package directory and unzip the SQL files that will define our database environment:

cd /usr/share/zabbix-server-mysql/
sudo gunzip *.gz

We will import the SQL files into our database. However, we first must create the database and do some initial configuration.

Log into MySQL as the root user using the password that you set up during installation:

mysql -u root -p
First, create a user for Zabbix that matches the information we entered in the “/etc/zabbix/zabbix_server.conf” file. Make sure to use the same information:

create user ‘zabbix’@’localhost’ identified by ‘Your.Password.Here’;
Next, we will create the Zabbix database:

create database zabbix;
Give control over the new database to the new user we created:

grant all privileges on zabbix.* to ‘zabbix’@’localhost’;
The following line will implement our new permissions:

flush privileges;
We are now done with the initial MySQL configuration. Exit back to the shell:

exit;
Now that we have our database set up, we can import the files that Zabbix needs to function. Enter the password for the user “zabbix” that you configured when prompted:

mysql -u zabbix -p zabbix < schema.sql
Do the same with the images file:

mysql -u zabbix -p zabbix < images.sql
And finally, import the data file:

mysql -u zabbix -p zabbix < data.sql

PHP Configuration
We need to adjust some values for the php processing of our monitoring data. Open the php configuration file:

sudo nano /etc/php5/apache2/php.ini
Search for and adjust the following entries. If they do not exist, add them:

post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = UTC
Save and close the file.

Next, we will copy the Zabbix-specific php file into the configuration directory:

sudo cp /usr/share/doc/zabbix-frontend-php/examples/zabbix.conf.php.example /etc/zabbix/zabbix.conf.php
Open the file:

sudo nano /etc/zabbix/zabbix.conf.php
Edit the following values. Use the same info as when you set up the database earlier:

$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'Your.Password.Here'

Save and close the file.

Configuring Additional Files
There are a few more files that we need to configure.

First, we’ll move the Zabbix apache file from the package directory:

sudo cp /usr/share/doc/zabbix-frontend-php/examples/apache.conf /etc/apache2/conf.d/zabbix.conf
Ensure that the “alias” mod is enabled within Apache:

sudo a2enmod alias
Restart Apache to use the copied configuration file:

sudo service apache2 restart
Edit the Zabbix init file to ensure that it performs the correct action:

sudo nano /etc/default/zabbix-server
Go to the bottom and adjust the “START” property to read “yes”:

START=yes
Save and close the file. We can now start Zabbix:

sudo service zabbix-server start
Installing and Configuring Zabbix Agent
Next, we need to configure the agent software that reports to the Zabbix server. We will install the agent software on our server machine and an additional client machine.

Follow these steps on both machines. Adjust the commands to reflect the correct information.

First, install the agent software:

sudo apt-get update
sudo apt-get install zabbix-agent
Next, we need to update the configuration files:

sudo nano /etc/zabbix/zabbix_agentd.conf
Edit the “Server” property to reflect the IP Address of the Zabbix server. For the agent configuration on the Zabbix server, you can use “127.0.0.1”:

Server=Zabbix.Server.IP.Address
Adjust the “Hostname” property to reflect the hostname of the machine being monitored.

Hostname=Hostname_Of_Current_Machine
Save and close the file.

Restart the agent software:

sudo service zabbix-agent restart
Logging In for the First Time
In your web browser, navigate to your Zabbix server’s IP address followed by “/zabbix”:

Your.Zabbix.IP.Address/zabbix
You will be presented with a login screen. The default credentials are as follows:

Username = admin
Password = zabbix

Leave a Reply

Your email address will not be published. Required fields are marked *