Устанавливаем Zabbix на FreeBSD 12.0

Print Friendly, PDF & Email

Задача:

Установить последнюю версию и сделать первоначальные настройки сервера мониторинга Zabbix

---------------------------------------------------------------

Устанавливать буду в виртуальной среде ESXi 6.7 , на операционной системе FreeBSD 12 установленной с диска FreeBSD-12.0-RELEASE-amd64-disc1.iso

Для начала переходим в домашнюю директорию и скачиваем исходники

cd ~
fetch --no-verify-peer https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.2.3/zabbix-4.2.3.tar.gz

Распаковываем и переходим с папку с исходниками

tar -zxvf zabbix-4.2.3.tar.gz
cd zabbix-4.2.3

Для просмотра доступных опций конфигурирования, выполняем команду:

./configure --help

Конфигурируем исходный код для Zabbix сервера и агента:

./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
./configure --enable-server --enable-agent --with-mysql --with-net-snmp \
--with-libcurl --with-libxml2 --with-ssh2 --enable-proxy --with-openipmi \
--with-unixodbc --with-jabber --with-ldap

with-libcurl – требуется для SMTP аутентификации
with-libxml2 – требуются для мониторинга виртуальных машин

Обновим список пакетов:

pkg update

Ищем последнюю версию mysql

pkg search mysql | grep server

получаем список

root@zabbix:/usr/home/xaxa # pkg search mysql | grep server
geoserver-mysql-plugin-2.15.0  MySQL DataStore implementation for GeoServer
mydns-mysql-1.1.0_8            DNS server designed to utilize the MySQL database
mysql-udf-0.3_3                Set of user-defined functions for the MySQL server
mysql55-server-5.5.62_1        Multithreaded SQL database (server)
mysql56-server-5.6.44          Multithreaded SQL database (server)
mysql57-server-5.7.26_1        Multithreaded SQL database (server)
mysql80-server-8.0.16          Multithreaded SQL database (server)
mysqld_exporter-0.11.0         Prometheus exporter for MySQL server metrics
mysqlwsrep56-server-5.6.42     MySQL database enhanced with Galera replication (server package)
mysqlwsrep57-server-5.7.24     MySQL database enhanced with Galera replication (server package)
root@zabbix:/usr/home/xaxa #

Пробовал я устанавливать mysql сервер версии 8.0.16, по при установке Zabbix появляется конфликт, поэтому советую использовать версию 5.6

pkg install mysql56-server

Добавляем в rc.conf строку для запуска mysql-server:

sysrc mysql_enable=YES

запускаем mysql:

service mysql-server start

Запускаем скрипт для выполнения начальных настроек

/usr/local/bin/mysql_secure_installation
root@zabbix:/usr/home/xaxa # /usr/local/bin/mysql_secure_installation



NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] н
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!




All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...
root@zabbix:/usr/home/xaxa #

Теперь устанавливаем, необходимый для работы Zabbix, веб-сервер Apache

pkg install apache24

Добавляем сервис в автозагрузку.

sysrc apache24_enable=YES

Проверяем какие версии есть

pkg search zabbix

Так как статья писалась в процессе установки, выкладываю для истории логи консоли в процессе установки mysql80-server

Добавляем в rc.conf строку для запуска mysql-server:

sysrc mysql_enable=YES

запускаем mysql:

service mysql-server start

Запускаем скрипт для выполнения начальных настроек

/usr/local/bin/mysql_secure_installation

Вот что получилось в консоле

oot@zabbix:/usr/home/xaxa # /usr/local/bin/mysql_secure_installation
mysql_secure_installation: [ERROR] unknown variable 'prompt=\u@\h [\d]>\_'.

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Please set the password for root here.

New password:

Re-enter new password:

Estimated strength of the password: 50
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!
root@zabbix:/usr/home/xaxa #

Теперь устанавливаем, необходимый для работы Zabbix, веб-сервер Apache

pkg install apache24

Добавляем сервис в автозагрузку.

sysrc apache24_enable=YES

Проверяем какие версии есть

pkg search zabbix

Переходим к установке Zabbix

 pkg install zabbix4-server

Вот что при установке было в консоле

root@zabbix:/usr/home/xaxa # pkg install zabbix4-server
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 7 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        zabbix4-server: 4.0.6
        fping: 4.0_1
        net-snmp: 5.7.3_19
        curl: 7.65.0_2
        ca_root_nss: 3.44
        unixODBC: 2.3.7
        mysql56-client: 5.6.44

Number of packages to be installed: 7

The process will require 85 MiB more space.
8 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/7] Fetching zabbix4-server-4.0.6.txz: 100%    3 MiB 583.4kB/s    00:05
[2/7] Fetching fping-4.0_1.txz: 100%   25 KiB  25.6kB/s    00:01
[3/7] Fetching net-snmp-5.7.3_19.txz: 100%    2 MiB 578.3kB/s    00:04
[4/7] Fetching curl-7.65.0_2.txz: 100%    1 MiB 416.6kB/s    00:03
[5/7] Fetching ca_root_nss-3.44.txz: 100%  297 KiB 304.4kB/s    00:01
[6/7] Fetching unixODBC-2.3.7.txz: 100%  456 KiB 467.4kB/s    00:01
[7/7] Fetching mysql56-client-5.6.44.txz: 100%    1 MiB 476.6kB/s    00:03
Checking integrity... done (1 conflicting)
  - mysql56-client-5.6.44 conflicts with mysql80-client-8.0.16_1 on /usr/local/bin/mysql
Checking integrity... done (0 conflicting)
Conflicts with the existing packages have been found.
One more solver iteration is needed to resolve them.
The following 10 package(s) will be affected (of 0 checked):

Installed packages to be REMOVED:
        mysql80-server-8.0.16
        mysql80-client-8.0.16_1

New packages to be INSTALLED:
        ca_root_nss: 3.44
        fping: 4.0_1
        net-snmp: 5.7.3_19
        curl: 7.65.0_2
        unixODBC: 2.3.7
        mysql56-client: 5.6.44
        zabbix4-server: 4.0.6

Installed packages to be REINSTALLED:
        pkg-1.10.5_5

Number of packages to be removed: 2
Number of packages to be installed: 7
Number of packages to be reinstalled: 1

The operation will free 177 MiB.
3 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching pkg-1.10.5_5.txz: 100%    3 MiB 678.8kB/s    00:05
[1/10] Deinstalling mysql80-server-8.0.16...
[1/10] Deleting files for mysql80-server-8.0.16: 100%
==> You should manually remove the "mysql" user.
==> You should manually remove the "mysql" group
[2/10] Deinstalling mysql80-client-8.0.16_1...
[2/10] Deleting files for mysql80-client-8.0.16_1: 100%
[3/10] Reinstalling pkg-1.10.5_5...
[3/10] Extracting pkg-1.10.5_5: 100%
[4/10] Installing ca_root_nss-3.44...
[4/10] Extracting ca_root_nss-3.44: 100%
[5/10] Installing fping-4.0_1...
[5/10] Extracting fping-4.0_1: 100%
[6/10] Installing net-snmp-5.7.3_19...
[6/10] Extracting net-snmp-5.7.3_19: 100%
[7/10] Installing curl-7.65.0_2...
[7/10] Extracting curl-7.65.0_2: 100%
[8/10] Installing unixODBC-2.3.7...
[8/10] Extracting unixODBC-2.3.7: 100%
[9/10] Installing mysql56-client-5.6.44...
[9/10] Extracting mysql56-client-5.6.44: 100%
[10/10] Installing zabbix4-server-4.0.6...
===> Creating groups.
Creating group 'zabbix' with gid '122'.
===> Creating users
Creating user 'zabbix' with uid '122'.
[10/10] Extracting zabbix4-server-4.0.6: 100%
Message from ca_root_nss-3.44:

********************************* WARNING *********************************

FreeBSD does not, and can not warrant that the certification authorities
whose certificates are included in this package have in any way been
audited for trustworthiness or RFC 3647 compliance.

Assessment and verification of trust is the complete responsibility of the
system administrator.

*********************************** NOTE **********************************

This package installs symlinks to support root certificates discovery by
default for software that uses OpenSSL.

This enables SSL Certificate Verification by client software without manual
intervention.

If you prefer to do this manually, replace the following symlinks with
either an empty file or your site-local certificate bundle.

  * /etc/ssl/cert.pem
  * /usr/local/etc/ssl/cert.pem
  * /usr/local/openssl/cert.pem

***************************************************************************
Message from net-snmp-5.7.3_19:

**** This port installs snmpd, header files and libraries but does not
     start snmpd by default.
     If you want to auto-start snmpd and snmptrapd:, add the following to
     /etc/rc.conf:

        snmpd_enable="YES"
        snmpd_flags="-a"
        snmpd_conffile="/usr/local/share/snmp/snmpd.conf /etc/snmpd.conf"
        snmptrapd_enable="YES"
        snmptrapd_flags="-a -p /var/run/snmptrapd.pid"

**** You may also specify the following make variables:

        NET_SNMP_SYS_CONTACT="zi@FreeBSD.org"
        NET_SNMP_SYS_LOCATION="USA"
        DEFAULT_SNMP_VERSION=3
        NET_SNMP_MIB_MODULES="host smux mibII/mta_sendmail ucd-snmp/diskio"
        NET_SNMP_LOGFILE=/var/log/snmpd.log
        NET_SNMP_PERSISTENTDIR=/var/net-snmp

     to define default values (or to override the defaults).  To avoid being
     prompted during the configuration process, you should (minimally) define
     the first two variables. (NET_SNMP_SYS_*)

     You may also define the following to avoid all interactive configuration:

        BATCH="yes"
Message from mysql56-client-5.6.44:

* * * * * * * * * * * * * * * * * * * * * * * *

Please be aware the database client is vulnerable
to CVE-2015-3152 - SSL Downgrade aka "BACKRONYM".
You may find more information at the following URL:

http://www.vuxml.org/freebsd/36bd352d-299b-11e5-86ff-14dae9d210b8.html

Although this database client is not listed as
"affected", it is vulnerable and will not be
receiving a patch. Please take note of this when
deploying this software.

* * * * * * * * * * * * * * * * * * * * * * * *
Message from zabbix4-server-4.0.6:

======================================================================
For Zabbix server and proxy daemons, as well as Zabbix frontend, a database is
required. It is not needed to run Zabbix agent.

% cd /usr/local/share/zabbix4/server/database

And follow the instructions:
https://www.zabbix.com/documentation/4.0/manual/appendix/install/db_scripts

Upgrade notes for 4.0.0:
https://www.zabbix.com/documentation/4.0/manual/installation/upgrade_notes_400

Upgrade procedure:
https://www.zabbix.com/documentation/4.0/manual/installation/upgrade/sources

Please see https://www.zabbix.com/ for detailed information about Zabbix.

Official Zabbix documentation:
https://www.zabbix.com/documentation/4.0/start

For Zabbix frontend "Welcome" screen. Enter the user name Admin with password
zabbix to log in as a Zabbix superuser.

For use NMAP please edit sudoers
======================================================================
This is a Zabbix LTS release!

Zabbix LTS releases are supported for Zabbix customers during five (5) years
i.e. 3 years of Full Support (general, critical and security issues) and 2
additional years of Limited Support (critical and security issues only).
Zabbix LTS version release will result in change of the first version number.

Stable release:         Zabbix 4.0
Release date:           1 October, 2018
End of Full Support:    31 October, 2021
End of Limited Support: 31 October, 2023

Zabbix Life Cycle & Release Policy:
https://www.zabbix.com/life_cycle_and_release_policy
======================================================================
root@zabbix:/usr/home/xaxa #

Как видим в процессе установки у нас удалился mysql80-server, так как zabbix конфликтует с этой версией mysql. Устанавливаем mysql56-server

pkg install mysql56-server

Ещё раз добавляем в автозагрузку

sysrc mysql_enable=YES

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *