2020-04-28 22:55:26 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
DB_NAME=zabbix
|
|
|
|
DB_USER=zabbix
|
|
|
|
DB_PASSWORD="$(openssl rand -base64 18)"
|
|
|
|
|
|
|
|
mysql -u root << EOF
|
|
|
|
create database ${DB_NAME} character set utf8 collate utf8_bin;
|
|
|
|
grant all privileges on ${DB_NAME}.* to ${DB_USER}@localhost identified by '${DB_PASSWORD}';
|
|
|
|
quit;
|
|
|
|
EOF
|
|
|
|
|
|
|
|
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u${DB_USER} -p${DB_PASSWORD} ${DB_NAME}
|
|
|
|
|
|
|
|
echo "DBPassword=${DB_PASSWORD}" >> /etc/zabbix/zabbix_server.conf.d/db.conf
|
2020-04-29 00:18:05 +02:00
|
|
|
sed "s@^\$DB['PASSWORD'].*$@\$DB['PASSWORD'] = \'${DB_PASSWORD}\';@g" /usr/share/zabbix/conf/zabbix.conf.php.example > /etc/zabbix/web/zabbix.conf.php
|
2020-04-28 22:55:26 +02:00
|
|
|
|
2020-04-28 23:00:32 +02:00
|
|
|
systemctl --now enable zabbix-server zabbix-agent nginx php7.3-fpm
|
2020-04-28 22:55:26 +02:00
|
|
|
|
2020-04-29 00:18:05 +02:00
|
|
|
systemctl --now mask zabbix-init.service
|