Prerequisites and setting up the environment
Of course, being a Zabbix web frontend, it will require a platform to run on—a web server with a PHP environment. We will need the following installed:
- A web server that is supported by PHP; Apache is the most common choice
- PHP version 5.4.0 or higher
In the next code block, we will show you how to install the webserver on CentOS and Debian:
On CentOS
# yum install httpd php php-ldap php-mysql
# systemctl enable httpd
# systemct start httpd
On Debian/Ubuntu
# apt install apache2 php php7.2-cli php7.2-mysql php7.2-common php7.2-curl php7.2-json php7.2-cgi libapache2-mod-php7.2 php7.2 php7.2-ldap
It is easiest to install these from the distribution packages as it will take care of all of the dependencies we need. Just make sure you install the correct PHP connector for your database—in our case, this is php-mysql. If you would like to make a connection to your AD/LDAP, you also need to make sure that php-ldap is installed.
Once you have all of these installed, it's time to set up the frontend. Again, there's a choice of using packages or installing from source. If you decided to go with the packages, you should have the frontend installed already and should be able to proceed with the configuration wizard section explained next. If you went with the source installation, it's just a simple copying of some files.
First, you have to decide where the frontend code has to go. Most distributions that package web servers use /srv/www/htdocs or /var/www. If you compiled the Apache web server from the source, it would be /usr/local/apache2/htdocs (unless you manually changed the prefix or installed an older Apache version). We will place the frontend in a simple subdirectory, zabbix.
Assuming you have Apache distribution packages installed with the web root directory at /srv/www/htdocs, placing the frontend where it is needed is as simple as executing the following as the root user:
# cp -r frontends/php /srv/www/htdocs/zabbix
The last thing we need to do is open our firewall so that our browser can connect on the web server port of our server:
CentOS/Red Hat
# firewall-cmd --add-service=http --permanent
# firewall-cmd --reload
Debian / Ubuntu
(standard there is no firewall installed you could use iptables or ufw or similar solution)
# apt install firewalld