关于zabbix服务端4.2的安装,事实上官网已经写的很详细了,我这里顺手记录一下,顺便做了点补充。
zabbix官网地址:https://www.zabbix.com/download
系统环境我这儿用的是Centos6.9,已预先装好了mysql、php、nginx
1、yum安装zabbix-server及agent:
# rpm -Uvh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
# yum clean all
# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
2、创建数据库,注意这里需要设置zabbix用户的密码:
# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix_password';
mysql> quit;
3、通过zabbix用户进行数据库导入,需要输入刚刚设置的zabbix用户密码:
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
4、修改php.ini中的以下参数,修改完成后php重加载:
max_execution_time=300
memory_limit=128M
post_max_size=16M
upload_max_filesize=2M
max_input_time=300
date.timezone=PRC
5、修改配置文件 vim /etc/zabbix/zabbix_server.conf :
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix_password
DBPort=3306
DBSocket=/tmp/mysql.sock # 这里的配置请参考自己mysql的配置文件/etc/my.cnf
7、启动zabbix_server
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start
6、下载源码包并解压后,取出zabbix站点文件:
wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.2.0/zabbix-4.2.0.tar.gz/download -O zabbix-4.2.0.tar
tar -zxvf zabbix-4.2.0.tar
mkdir -p /opt/web/zabbix
cp -rf zabbix-4.2.0/frontends/php/* /opt/web/zabbix
chown -R www:www /opt/web/zabbix
7、配置nginx,添加一个站点:
server
{
listen 80;
index index.html index.htm index.php;
root /opt/web/zabbix;
include enable-php.conf;
location /nginx_status
{
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log /tmp/access.log;
}
重加载nginx:
nginx -s reload
8、打开浏览器进行配置,http://server_ip/