2017年9月16日星期六

Debian 9.1 安装 zabbix 3.4

安装 mariadb

aptitude -y install software-properties-common dirmngr
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
add-apt-repository 'deb [arch=amd64] http://mirrors.tuna.tsinghua.edu.cn/mariadb/repo/10.2/debian stretch main'
aptitude update
aptitude -y install mariadb-server

降级 libmariadbclient18

aptitude -y install libmariadbclient18=10.1.23-9+deb9u1

建立 zabbix 数据库和建立管理帐户

mysql -uroot -p<mariadb密码> <<EOF
create database zabbix character set utf8 collate utf8_general_ci;
use mysql;
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'%' IDENTIFIED BY 'ynza!@#456' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EOF

重启 mariadb

systemctl restart mysql.service

安装 zabbix

wget http://repo.zabbix.com/zabbix/3.4/debian/pool/main/z/zabbix-release/zabbix-release_3.4-1+stretch_all.deb
dpkg -i zabbix-release_3.4-1+stretch_all.deb
aptitude update
aptitude -y install zabbix-server-mysql zabbix-frontend-php php7.0-bcmath php7.0-mbstring php7.0-xml
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -pynza\!@#456 zabbix
sed -i "s/# DBHost/DBHost/g" /etc/zabbix/zabbix_server.conf
sed -i "s/# DBPassword=/DBPassword=ynza\!@#456/g" /etc/zabbix/zabbix_server.conf
systemctl enable zabbix-server.service
sed -i "s/# php_value date.timezone Europe\/Riga/php_value date.timezone Asia\/Shanghai/g" /etc/apache2/conf-enabled/zabbix.conf

中文支持,增加 zh_CN.UTF-8

dpkg-reconfigure locales

重启 zabbix 和 apache2

systemctl restart zabbix-server.service
systemctl restart apache2.service

浏览器访问界面

http://yourip/zabbix