For everyone who monitors a network, whether it be for home or your office, it’s always a good thing to know what is happening on your devices, and on your network. Zabbix is one of the myriad of tools that helps us out with that task.
OS: CentOS 7
Disk: 32GB (for testing), 64GB+ (for production)
So now we have our VM configured in VirtualBox, and our CentOS ISO already downloaded. Now we can go through the install process. I’ll make note of any special changes I made and follow them up with a Screenshot…
Well, that was easy. I chose not to configure a Static IP address on the server now, we can do that later.
Now that we have the system installed, we can go ahead and install the epel-release, run updates, and a few utilities that help us out along the way… Go ahead and log in to the system as the user you created during the install process, and then
to become root… First thing we’ll do is switch SELinux to permissive. This will ensure everything works. A future topic will be written for running a Zabbix Server with SELinux on.
Change the line that says enforcing to permissive, and save the file. After making that change, reeboot the server.
Next up, we will perform updates, and install the epel-release repository. So log back in….
sudo -i yum upgrade yum install epel-release reboot
After your reboot has finished, log back in and become root yet again and we’ll go go and install the CentOS repos for Zabbix.
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm yum update
Will intall the Zabbix repositories and load them into the package manager. At the time of writing, the Repository is at version 3.0.1, while the source code release is at 3.0.4.
Next up we need to:
yum install mariadb mariadb-server zabbix-server-mysql zabbix-web-mysql
This will install and configure Apache, MySQL, and PHP for use with Zabbix. As the installation goes along, check to make sure it’s not waiting on you to answer questions about accepting the Zabbix packages. After the install finishes, configure Apache, MySQL, and the Zabbix servers to start.
Let’s configure MariaDB. The three lines below configure MariaDB to start at boot, and help us to set up some basic security.
systemctl enable mariadb systemctl start mariadb mysql_secure_installation
Next up, we’ll configure Apache to auto start:
systemctl enable httpd systemctl start httpd
And now we will create the Zabbix database. When prompted, enter the password for the root user (you just set this password up). The last step can take a minute or two. This creates the zabbix dadtabase with a usernamed ‘zabbix’ and a password of… You guessed it! (Okay, if you didn’t, the password is also zabbix).
Generally, it’s a good idea to use a secure password for service accounts.
mysql -u root -p create databse zabbix; grant all on zabbix.* to zabbix identified by 'zabbix'; flush privileges; exit; cd /usr/share/doc/zabbix-server-mysql-3.0.0 zcat create.sql.gz | mysql -uroot zabbix -p
Next up, we need to edit the Zabbix server configuration so that it is correctly pointed to the new database we just created.
cd /etc/zabbix vi zabbix_server.conf
Find the line that has DBHost, and uncomment it (remove the # sign) so that it reads: DBHost=localhost
Find the lines that have DBName, DBUser and DBPassword and set those appropriately as well (see my comments above).
Now that we’ve got that, we can:
systemctl enable zabbix-server systemctl start zabbix-server tail -f /var/log/zabbix/zabbix_server.log
Watch the output of tail for a minute to make sure that there are no errors showing up.
(oops… Guess I should go back and follow my own instructions….)
If your output looks something like this:
then we can move on to configuring PHP and Apache.
We’ll start by going to check on the Apache settings that are installed for Apache.
cd /etc/httpd/conf.d vi zabbix.conf
The only thing we should have to change here is to set your timezone appropriately. The PHP settings for that option are available here: http://php.net/manual/en/timezones.php
Well, if you’re still with me, that means everything should be just about ready to rock and roll! Run the command below to apply the timezone.
systemctl restart httpd
If you get no error messages, then, everything should be setup and ready to go! Point your web browser to the IP address of your Zabbix server:
If you see the web interface, we’re done for now.
In Part 2, we’ll go through the web interface and configure a few settings that can make things easier as you are deploying agents and such.