Zabbix installation on Ubuntu 16.04 LTS

Loading

Here is the complete guide of how to install Zabbix centralized monitoring Server in Ubuntu 16.04. I will install this with MySQL 5.7 and PHP 7.1. I Hope you would like this.
Run the following commands for update all the repository and upgrade the installed package:

Repository update:
# apt update -y
# apt upgrade -y

Install and configure Apache2 (Web Server):
# apt install apache2 apache2-utils -y
# a2enmod rewrite
# a2enmod deflate
# a2enmod ssl
# a2enmod headers

# sed -i ‘165s/Options Indexes FollowSymLinks/Options FollowSymLinks/g’ /etc/apache2/apache2.conf

# sed -i ‘166s/AllowOverride None/AllowOverride All/g’ /etc/apache2/apache2.conf

# echo “ServerSignature Off” >> /etc/apache2/apache2.conf
# /etc/init.d/apache2 restart

Now we have to Install and Configure PHP 7.1:
# apt-get install python-software-properties -y
# add-apt-repository ppa:ondrej/php
# apt-get update -y

# apt-get install -y php7.1 php7.1-mcrypt php7.1-mbstring php7.1-curl php7.1-cli php7.1-mysql php7.1-gd php7.1-intl php7.1-xsl php7.1-bcmath php7.1-bz2 php7.1-gd php7.1-zip php7.1-imap php7.1-soap php7.1-tidy

# /etc/init.d/apache2 restart

Optional – If you want to see all PHP module that you have installed, just type below command, or you can create an info.php in your Apache document root directory. info PHP code is given below:

# php -m

Info.php code:

Now we have to Install MySQL 5.7:
# apt-get update -y
# apt-get install mysql-server -y

You can check MySQL version from below command (Optional):

# mysql -V

Zabbix Latest Repository Installation:
# wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb

# dpkg -i zabbix-release_3.2-1+xenial_all.deb
# apt-get update

Install and Configuration of Zabbix Server:
Zabbix server and web frontend installation with MySQL database:

# apt-get install zabbix-server-mysql zabbix-frontend-php

Creating initial database:
Create Zabbix database and user on MySQL by the following commands, where shall be replaced with the actual root password. In my case, I have set 123 as MySQL root and 456 as Zabbix user password. You can set different pass. (e.g., # mysql -uroot -p123) and with new password for Zabbix user on the database (including apostrophes: …identified by ‘456’;):

# mysql -uroot -p123
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by ‘456’;

mysql> quit;

Import Database:
If you are installing the fresh copy of Zabbix server, Then you have to import default Zabbix database for initial schema and data. You will find the default Zabbix database under “/usr/share/doc/zabbix-server-mysql” this directory.
Or if you have a previous Zabbix server database backup file, then you have to import your old database instead of the default Zabbix database.

I am installing the fresh copy of Zabbix, so I will import the default zabbix database for initial schema and data.

# cd /usr/share/doc/zabbix-server-mysql
# zcat create.sql.gz | mysql -uzabbix -p zabbix

You will ask for the password to import database, and you have to give the right MySQL user password.

Zabbix Server configuration:
Now you need to make some change in your Zabbix server configuration file.

#vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=456

Save the file by typing :x!
Before save you should give your information here according to you.
Now you have to start the Zabbix server.

# /etc/init.d/zabbix-server start
# update-rc.d zabbix-server enable

Now you have to change your timezone to your preferred location in your PHP configuration file.

# vim /etc/zabbix/apache.conf


php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga

Uncomment the date.timezone and change it to your preferred location.
Restart the apache2 service.

# /etc/init.d/apache2 restart

That’s All, You have finished the installation process of Zabbix server. Now you should access the Zabbix frontend installation page. Just IP/zabbix/setup.php in your browser for access the Zabbix frontend installation page.
** If you have any firewall in your network then make sure you have opened 80 port in your firewall.

Thank You

Source – zabbix.com

Leave a Reply

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