Zabbix搭建
环境
Centos7.5
Zabbix4.4
Mariadb5.5
PHP5.4
配置yum源,若有YUM可忽略此步骤
使用服务器自带YUM即可,如果没有YUM源,就安装一个。
# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
# mv CentOS7-Base-163.repo /etc/yum.repos.d/
关闭防火墙,搭建LAMP环境
# systemctl stop firewalld
#systemctl disable firewalld
# yum -y install httpd mariadb mariadb-server php php-mysql //安装LAMP环境
# systemctl start httpd
# systemctl start mariadb
# systemctl enable httpd
# systemctl enable mariadb
# mysql_secure_installation //(YYNYY)
安装zabbix
# rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX //zabbix的一个秘钥文件
# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
配置数据库
# mysql -uroot -p //接着输入刚刚设置的数据库密码
> CREATE DATABASE zabbix DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
注释:创建数据库zabbix,设置数据库默认编码为utf8,校对规则。
> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
注释:授予相应权限
> exit;
文件读入数据库
# cd /usr/share/doc/zabbix-server-mysql-4.4.8/
# zcat create.sql.gz | mysql -uroot -p zabbix
配置zabbix
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
# systemctl restart zabbix-server
# systemctl enable zabbix-server
配置PHP,校对时间
# vim /etc/httpd/conf.d/zabbix.conf
<IfModule mod_php5.c>
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/Shanghai //修改这条即可
</IfModule>
# yum -y install ntp
# ntpdate -u cn.pool.ntp.org
# systemctl restart httpd
配置zabbix端
打开浏览器输入:主机IP地址/zabbix //如图 直接Next step
第二步:检查状态是否都ok,若OK,下一步
第四步:
第五步:
登陆用户名默认: Admin ,注意A是大写,密码:zabbix
|