HOW TO INSTALL ZABBIX ON UBUNTU
Step 1: Installing Apache, MySQL and PHP
$ sudo apt-get update
$ sudo apt-get install apache2
$ sudo apt-get install mysql-server
$ sudo apt-get install php5 php5-cli php5-common php5-mysql
Update timezone in php configuration file /etc/php5/apache2/php.ini. Like below
[Date]
; http://php.net/date.timezone
date.timezone = โAsia/Kolkataโ
Step 2: Adding Apt Repository
Before installing Zabbix first configure zabbixzone rpm repository in our system using the following commands.
$ wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-4+ubuntu$(lsb_release -rs)_all.deb
$ sudo dpkg -i zabbix-release_3.0โ1+trusty_all.deb
$ sudo apt-get update
Step 3: Configure firewall
If you have a UFW firewall installed on Ubuntu, use these commands to open TCP ports: 10050 (agent), 10051 (server), and 80 (frontend):
ufw allow 10050/tcp
ufw allow 10051/tcp
ufw allow 80/tcp
ufw reload
Step 4: Install Zabbix Server
After adding Zabbix apt repository to your system use the following command to install Zabbix using mysql database.
$ sudo apt-get install zabbix-server-mysql zabbix-frontend-php
Step 5: Create Database Schema
Now create a database schema for your Zabbix server. First use the following commands to create mysql database and user for your Zabbix server
$ mysql -u root -p
mysql> CREATE DATABASE zabbixdb;
mysql> GRANT ALL on zabbixdb.* to zabbix@localhost IDENTIFIED BY โpasswordโ;
mysql> FLUSH PRIVILEGES;
Now restart zabbix database schema in newly created database
$ cd /usr/share/doc/zabbix-server-mysql
$ zcat create.sql.gz | mysql -u root -p zabbixdb
Step 6: Create MySQL partitions on History and Events tables
Zabbixโs housekeeping process is responsible for deleting old trend and history data. Removing old data from the database using SQL delete query can negatively impact database performance. Many of us have received that annoying alarm โZabbix housekeeper processes more than 75% busy
โ because of that.
That problem can be easily solved with the database partitioning. Partitioning creates tables for each hour or day and drops them when they are not needed anymore. SQL DROP is way more efficient than the DELETE statement.
You can partition MySQL tables in 5 minutes using this simple guide.
Step 7: Edit Zabbix Configuration File
Now edit Zabbix server configuration file /etc/zabbix/zabbix_server.conf in your favorite text editor and update the following entries.
DBHost=localhost
DBName=zabbixdb
DBUser=zabbix
DBPassword=password
Step 8: Restart Apache and Zabbix
Zabbix creates its own apache configuration file /etc/zabbix/apache.conf.
Uncomment 2 lines in apache.conf that starts with โ# php_value date.timezone
โ by removing symbol #
and set the right timezone for your country, for example:
php_value date.timezone <Out time zone>
Use the following command to restart the Apache service.
$ sudo service apache2 restart
Zabbix server configuration file are located at /etc/zabbix/zabbix_server.conf. Restart apache using below command.
$ sudo service zabbix-server restart
After starting zabbix service, letโs go to zabbix web installer and finish the installation.
Step 9: Start Zabbix Web Installer
Zabbix web installer can be accessed using the following URL, Change FQDN as per your setup.
sudo vim /etc/hosts
123.123.123.123 svr1.tecadmin.net