Table of Contents
Installing Zabbix on different systems
I am installing Zabbix server and front end using PostgreSQL.
OpenBSD 6.6
For this install, I have setup an OpenBSD vmm instace with a fresh install of OpenBSD 6.6 (amd64). I will be installing the latest (v4.4.0) release of Zabbix server and frontend. For all additional packages I will be using what comes packaged with the OpenBSD 6.6 release. Unless I find a reason for installing something different.
OpenBSD updates
Increase some limits
By default, a few of the system semephore and shared memory limits are too low.
doas vi /etc/sysctl.conf kern.pool_debug=0 ddb.panic=0 kern.maxproc=16384 kern.maxthread=16384 kern.maxfiles=262144 kern.shminfo.shmall=999999999 kern.shminfo.shmmax=1999999999 kern.seminfo.semmni=256 kern.seminfo.semmns=2048 kern.somaxconn=1024
Setup the package management
Edit your .profile and add the following lines.
PKG_PATH="ftp://mirrors.syringanetworks.net/pub/OpenBSD/6.6/packages/amd64/" export PKG_PATH
Install packages
Install utilities needed to configure and install Zabbix
doas pkg_add curl htop libssh2 net-snmp pcre wget
Install PostgreSQL
It would appear that when installing the PostgreSQL server, pkg_add did not create the home directory for the _postgresql user. Installing postgresql-server will set the correct owner/group of the home directory.
doas mkdir -m u=rwx,g=rwx,o= -p /var/postgresql
Install PostgreSQL and populate DB
doas pkg_add postgresql-server postgresql-client
Installize PostgreSQL server
doas su _postgresql cd initdb -D /var/postgresql/data/ -U postgres --auth=md5 --pwprompt --encoding=UTF-8 --locale=en_US.UTF-8
You will see something like the following:
The files belonging to this database system will be owned by user "_postgresql". This user must also own the server process. The database cluster will be initialized with locale "en_US.UTF-8". The default text search configuration will be set to "english". Data page checksums are disabled. Enter new superuser password: Enter it again: creating directory /var/postgresql/data ... ok creating subdirectories ... ok selecting default max_connections ... 30 selecting default shared_buffers ... 128MB selecting default timezone ... America/Los_Angeles selecting dynamic shared memory implementation ... posix creating configuration files ... ok running bootstrap script ... ok performing post-bootstrap initialization ... ok syncing data to disk ... ok Success. You can now start the database server using: pg_ctl -D /var/postgresql/data/ -l logfile start openbsd$ exit
Enable and start the PostgreSQL server
doas rcctl enable postgresql
Populate the Zabbix DB within PostgreSQL
Create Zabbix PostgreSQL user
doas -u _postgresql createuser -U postgres --pwprompt zabbix Enter password for new role: Enter it again: Password:
Setup the database for Zabbix with the just create Zabbix user
doas -u _postgresql createdb -U postgres -O zabbix -E Unicode -T template0 zabbix
Configure the database for Zabbix server. Edit file /etc/zabbix/zabbix_server.conf
DBPassword=password
Zabbix Server from packages
Install Zabbix server and agent from the package tree
doas pkg_add zabbix-server-4.0.11-pgsql zabbix-agent-4.0.11
Import the initial schema and data
cat /usr/local/share/zabbix/schema/postgresql/schema.sql | doas psql -U zabbix zabbix # stop here if you are creating database for Zabbix proxy cat /usr/local/share/zabbix/schema/postgresql/images.sql | doas psql -U zabbix zabbix cat /usr/local/share/zabbix/schema/postgresql/data.sql | doas psql -U zabbix zabbix
Enable and start daemons
doas rcctl enable zabbix_server doas rcctl start zabbix_server doas rcctl enable zabbix_agentd doas rcctl start zabbix_agentd
Tail log file to make sure zabbix is running and working as expected
tail -f /tmp/zabbix_server.log
Zabbix Server from source
Download the latest release:
wget -O zabbix-4.4.0.tar.gz "https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.4.0/zabbix-4.4.0.tar.gz/download"
Extract that thing
tar zxf zabbix-4.4.0.tar.gz
When installing from source, you are going to need to manually create the user & group for zabbix to use.
doas groupadd zabbix doas mkdir -m u=rwx,g=rwx,o= -p /usr/lib/zabbix doas useradd -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix doas chown zabbix:zabbix /usr/lib/zabbix
Import the initial schema and data
cd zabbix-4.4.0/database/postgresql cat schema.sql | doas psql -U zabbix zabbix # stop here if you are creating database for Zabbix proxy cat images.sql | doas psql -U zabbix zabbix cat data.sql | doas psql -U zabbix zabbix
Configure Zabbix source
cd zabbix-4.4.0/ ./configure --enable-server --enable-agent --with-postgresql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-ssh2 --with-openipmi --with-zlib --with-openssl
You will see a lot of output as it processes this command. Sit back and have a drink of your favorite beverage.
Install Zabbix
doas make install
Zabbix frontend from packages
Install package(s)
doas pkg_add zabbix-web-4.0.11p0
Update the zabbix.conf.php with the following
$DB['TYPE'] = 'POSTGRESQL'; $DB['PASSWORD'] = '<YOUR_PASSWORD>';
Install PHP-FPM & enable httpd
Install PHP
doas pkg_add php-7.3.10 php-pgsql-7.3.10 php-gd-7.3.10 php-ldap-7.3.10
Enable PHP extension
doas ln -sf /etc/php-7.3.sample/pgsql.ini /etc/php-7.3/ doas ln -sf /etc/php-7.3.sample/gd.ini /etc/php-7.3/ doas ln -sf /etc/php-7.3.sample/ldap.ini /etc/php-7.3/
Change various php-*.ini configuration options
doas vi /etc/php-7.3.ini post_max_size = 16M max_execution_time = 300 max_input_time = 300 date.timezone = America/Los_Angeles
Configure /etc/httpd.conf
Modify your /etc/httpd.conf file to resemble something like this:
doas vi /etc/httpd.conf types { include "/usr/share/misc/mime.types" } server "HOSTNAME" { listen on * tls port 443 tls { certificate "/etc/ssl/HOSTNAME.pem" key "/etc/ssl/private/HOSTNAME.key" } root "/zabbix" directory { index index.php } # Increase connection limits to extend the lifetime connection { max requests 500, timeout 3600 } connection { max request body 8388608 } location "/conf/*" { block return 401 } location "*.php*" { fastcgi socket "/run/php-fpm.sock" } location "/.well-known/acme-challenge/*" { root "/acme" request strip 2 } }
Enable and start both the httpd and php73_fpm daemons:
doas rcctl enable php73_fpm doas rcctl start php73_fpm doas rcctl enable httpd doas rcctl start httpd
If you want to have a TLS secured connection, follow these instructions here.
Zabbix frontend from source
We will use the bundled httpd OpenBSD web server with PHP enable with PgSQL support.
Copy Zabbix front-end web files to the correct location for httpd to serve them up.
doas cp -rp /home/jlucas/zabbix-4.4.0/frontends/php/* /var/www/htdocs/
Debian 9
Using the packages available in the OEM package tree, you will be installing Zabbix 3.0. If you want the latest Zabbix version go here and follow the instructions.
Install Packages
apt install zabbix-server-pgsql zabbix-frontend-php php-pgsql zabbix-agent
Create DB user and DB
sudo -u postgres createuser --pwprompt zabbix sudo -u postgres createdb -O zabbix zabbix
Create DB schema, insert initial data. The order is important!
zcat /usr/share/zabbix-server-pgsql/schema.sql.gz | sudo -u zabbix psql zabbix zcat /usr/share/zabbix-server-pgsql/images.sql.gz | sudo -u zabbix psql zabbix zcat /usr/share/zabbix-server-pgsql/data.sql.gz | sudo -u zabbix psql zabbix
Edit file /etc/zabbix/zabbix_server.conf and set DB password
DBPassword=password
Enable the Zabbix Apache configuration
sudo a2enconf zabbix-frontend-php
Uncomment and set the correct Time zone value for php_value date.timezone within the above Apache configuration file. See here for a complete list of allowed values.
sudo vi /etc/apache2/conf-available/zabbix-frontend-php.conf
Start Zabbix server and agent processes and make it start at system boot:
systemctl restart zabbix-server zabbix-agent apache2 systemctl enable zabbix-server zabbix-agent apache2
Create and set permissions on front end configuration file
sudo touch /etc/zabbix/zabbix.conf.php sudo chmod 0665 /etc/zabbix/zabbix.conf.php sudo chgrp www-data /etc/zabbix/zabbix.conf.php
Connect to your newly installed Zabbix frontend: http://server_ip_or_name/zabbix Follow steps described in Zabbix documentation: Installing frontend