Install the Zabbix 3.0.0 beta from source on CentOS or RHEL

It’s been a while since I was busy with Zabbix but I have been following their alpha releases for version 3 quite closely. Now that Zabbix released the first beta release for version 3, I thought that it was time to have a good look at this new and improved version. Zabbix is used a lot and more and more companies count on it as their primary monitoring solution. In this post, I’ll explain how to get started with the beta of the latest Zabbix release on CentOS 7 or RHEL 7.

I’ve made some posts earlier about Zabbix and I can see that the topic is quite popular on my blog. Since the long awaited version 3 of this monitoring tool has recently had a beta-release, I’m too curious to not check it out and decided to created this post.

For more information about the current stable release, check out this previous post: http://jensd.be/393/linux/install-zabbix-on-centos-7-or-rhel-7

It might be obvious but I do want to point out that a beta is not supposed to be used for production work. Nevertheless, it can give you a heads-up and a good look and feel for the final release. When you encounter bugs, I recommend submitting them to the dev team because from their point of view, that’s what beta’s are for and why they are released.

The beta does not come in a ready-made distro packages but is either delivered as an appliance or as source package. The appliance-version is something new and it allows you to run the Zabbix beta as a ready-made VM or Live ISO. Off course that would be too easy so I decided to install Zabbix from source on a minimal CentOS/RHEL 7 installation.

Download the sources

The first step in the process, is to download the source for the beta from the Zabbix website. The sources can be found here: http://www.zabbix.com/download.php. After downloading, unpack them (in your home directory).

Create a user to run the Zabbix processes

I shouldn’t mention that it isn’t a very good idea to run Zabbix under root so let’s create a new user that will run the Zabbix processes. Keep in mind that it’s also a good practice to use a separate user to run the Zabbix agent.

Setup the database

Zabbix uses a database to store all of it’s information. Most common DB-systems are supported but for this installation, I chose to go with MySQL (or the fork MariaDB).

Install MariaDB:

After the installation, we can start MariaDB and run the initial setup script to configure the root password. After that, let’s enable MariaDB to let it start on boot:

At this point, our database is installed and running but doesn’t contain any database, tables or user for Zabbix to use. Let’s go ahead and create those. Replace the password “secretpass” with your own password:

After creating the database and user, we can create the database structure. The SQL-scripts to do so are delivered with the source in database/mysql/:

Now that we created the DB structure, the database setup is complete.

Compile and install the Zabbix source

Before we can start compiling the source, we need to install the required dependencies for the compilation. The list of dependencies depends on the options you supply during the configuration phase.

Once the dependencies are installed, we can run ./configure with the options which we require. For this post, I chose to run the agent and server on one host and included the most common options:

Once ./configure made a MakeFile for the installation, we can do the actual compilation by executing make:

With make, we compiled all binaries and the last step to complete the Zabbix backend installation is to copy the files to the correct locations. This requires superuser privileges:

Initial Zabbix configuration and preparation

Before we can start the Zabbix agent and server, it’s a good thing to verify the configuration files and change the parameters to values which are suited for your installation.

For the server, edit the file /usr/local/etc/zabbix_server.conf and include the following. Make sure that you replace the password with the one specified when creating the database user:

For the agent, edit the file /usr/local/etc/zabbix_agentd.conf and include the following:

As you can see in the contents of the configuration files, I changed the directory containing the logs to /var/log/zabbix and I specified a new location for the Pidfiles, so we need to make sure those directories exist and have the correct permissions:

The backend is installed and configured so we could start the binaries manually under the Zabbix user but that’s not a very clean approach. I know it’s a beta but even in such case, it would hurt me to do so and I think it’s a better idea to create systemd-service files for the server and agent.

Create service-file /etc/systemd/system/zabbix-server.service with the following contents:

Create service-file /etc/systemd/system/zabbix-agent.service with the following contents:

Let systemd reload the service files:

Run Zabbix for the first time

The installation of the Zabbix backend (server) is completed and the service can be started. Since we created nice systemd service files, we can start the server and agent as any other service:

The last part (the netstat command) is optional but I just did it to check if the agent and server are listening for incoming connections.

Now that the services are started, the backend setup of Zabbix is complete and we can proceed with the frontend.

Zabbix frontend installation

To control the Zabbix server, we need to install a frontend. This is the webinterface used to manage Zabbix and for daily use. The frontend is running on Apache with PHP.

The first step in running the frontend is to install Apache, PHP and all required PHP libraries for Zabbix:

The files for the frontend are supplied with the source in frontends/php so all we need to do is to copy them to our htdocs location.

After copying the files, it’s important to set the permissions and SELinux context correct so Zabbix can write to the correct directory if needed:

Another SELinux boolean needs to be changed in order for the Zabbix webinterface to be allowed to communicate with the server:

We installed PHP but the default options for PHP are not optimal for Zabbix and the installer will not continue without them having good values. Let’s correct them to suitable values for Zabbix:

That should be all for the frontend installation and now is a good time to start Apache. While we’re busy with that, let’s also enable Apache on boot:

Before we can access the Zabbix webinterface, we need to open up the firewall to port 80 (HTTP):

Zabbix frontend configuration

The biggest part of the installation is done and the last step is to connect to the webinterface and walk trough the setup. Point your browser to the IP or hostname of the server where you just performed the above steps and follow the instructions:

zab1

Click next step and verify that all requirements are fulfilled:

zab2In the next step, enter the database password which you specified when creating the database user in the beginning:

zab3

Go trough the server details, verify the summary and click Next to write the configuration file to /var/www/html/zabbix/conf:

zab6

This should be all it takes to setup Zabbix and at this point, you can start using Zabbix.

Use Zabbix

Now that we installed and started the backend, installed, started and configured the frontend, it’s time to explore your new Zabbix version 3 installation. To do so, connect to the IP or hostname of the server with your browser and login with Admin/zabbix. (please note that this is case-sensitive):

zab7

One first thing which you should do, is to enable the Zabbix server itself. This can be done in Configuration – Hosts – Zabbix server -Enable:

zab9

After performing this step, you should start to see data about the Zabbix server in the graphs:

zab10

For a quick guide on how to use Zabbix, I’ll have to point you to my previous post about Zabbix. Later, when I find some more time, I will try to update that information for the new version.

Let me know what you think about the new release. To my idea, it’s already quite stable and doesn’t contain too much bugs for a beta. Enjoy.

Leave a Reply

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