Skip to main content
Zabbix

How to install and configure Zabbix 3 on Debian 8 (Jessie)

Zabbix is an enterprise open source monitoring software for networks and applications. It is designed to monitor and track the status of various network services, servers, and other network hardware. The Zabbix server can check standard networking services like HTTP, FTP, SMTP, IMAP etc. We need to install and configure a Zabbix agent for gathering data about CPU, disks, internal system process, RAM, etc.

Let's check the steps for installing and configuring Zabbix on a Debian 8 server:

Step 1: Install the required dependencies:

  At the moment while writing this article, Zabbix does not provide any official pre-compiled binary package for Debian 8. We need to manually download, compile and install zabbix from the source. To perform the mentioned task, we need to install certain dependencies beforehand:

sudo apt-get install build-essential gcc curl wget libsnmp-dev libcurl4-gnutls-dev libxml2-dev 

  Also, we need to have a LAMP setup, most of us should be aware of what is a LAMP. If not you can through this article on how to install lamp on Debian 8.

Step 2: Fine tuning the settings:

  In order to get Zabbix working, we need to fine tune some PHP settings. Open the php.ini file using

sudo nano /etc/php5/apache2/php.ini

  Then find and edit the following values:

post_max_size = 16M
max_execution_time = 300
date.timezone = Continent/City
max_input_time = 300
always_populate_raw_post_data = -1

  Save the file and restart apache for the changes to reflect.

Step 3: Download, compile and install Zabbix server:

  Since all the prerequisite things are installed, now we can download the zabbix tar file using the wget utility.

wget http://repo.zabbix.com/zabbix/3.0/debian/pool/main/z/zabbix/zabbix_3.0.1.orig.tar.gz

  Extract the zabbix tar file and enter the extracted directory

tar -zxvf zabbix_3.0.1.orig.tar.gz
cd zabbix_3.0.1

  We need the compile the source by passing certain configuration parameters. For a standard installation, use the following command:

./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2

  To know about the compiling parameters, use the following command:

./configure -h

  After configuring zabbix, we need to create installable binaries. For that use make command followed by make install to install zabbix

make
make install

Step 4: Post-installation configurations

  We need to have an unprivileged user to run Zabbix processes. Let's create a new group and user with the name Zabbix, then add Zabbix to apache group

sudo groupadd zabbix
sudo useradd -g zabbix -d /usr/local/share/zabbix -s /bin/false zabbix
sudo usermod -aG www-data zabbix 

Step 5: Zabbix database:

  As mentioned earlier, we need a database for zabbix, so create a new database for zabbix. Enter your mysql/mariadb interface, then use the following commands

create database zabbix;
grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'password';
flush privileges;

  After creating the database, we need to import certain tables. The sql files can be found in your extracted directory.

mysql -u zabbix -p zabbix < database/mysql/schema.sql
mysql -u zabbix -p zabbix < database/mysql/images.sql
mysql -u zabbix -p zabbix < database/mysql/data.sql

  Enter the password for the mysql/mariadb zabbix user

Step 6: Zabbix frontend configuration:

  Copy frontend configuration files from the extracted directory to a zabbix_frontend directory inside apache webroot.

cp -rf zabbix-3.0.1/frontends/php/* /var/www/html/zabbix_frontend/

Step 7: Zabbix server configurations:

  Open the zabbix server configuration file, then find and update the following values accordingly

nano /usr/local/etc/zabbix_server.conf

ListenPort=10051/
LogFile=/var/log/zabbix_server.log
DBHost=localhost   ## Replace with the IP of the remote database in case MySQL server is located on a different host
DBName=zabbix  ## Zabbix MySQL/Mariab database name
DBUser =zabbix   ## Zabbix MySQL/Mariab database username
DBPassword=password  ## Zabbix MySQL/Mariab database password
DBSocket=/var/run/mysqld/mysqld.sock
DBPort=3306

  Then create the server log file and assign the permissions.

touch /var/log/zabbix_server.log
chmod 775 /var/log/zabbix_server.log
chgrp zabbix /var/log/zabbix_server.log

Step 8: Start Zabbix agent and server:

/usr/local/sbin/zabbix_server
/usr/local/sbin/zabbix_agentd
/usr/local/sbin/zabbix_agent

  Then setup a virtual host for Zabbix and navigate to the corresponding domain. You can access the Zabbix frontend now.
  Install the frontend using the necessary settings. Finally, after installing Zabbix, use the default credentials as given below:

Username: admin
Password: zabbix

  Don't forget to make the Zabbix server and agent start on boot.
 

Comments

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.