zabbix的安装方式有很多,这次用个比较简单的,通过阿里云进行安装。
我的环境是centos7.3 1.3.10.0-514.26.2.el7.x86_64
1.由于默认安装的PHP是 5.4,漏洞较多,所以先把PHP5.6 安装上,
安装连接http://adamcrab.blog.51cto.com/842470/1946516
2.使用阿里yum源
[root@localhost ~]# rpm -ivh http://mirrors.aliyun.com/zabbix/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm Retrieving http://mirrors.aliyun.com/zabbix/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm warning: /var/tmp/rpm-tmp.yt7CBy: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY Preparing... ################################# [100%] Updating / installing... 1:zabbix-release-3.2-1.el7 ################################# [100%]
[root@localhost ~]# ls /etc/yum.repos.d/ CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo zabbix.repo
zabbix.repo 就是刚才执行产生的文件
3.安装相应的软件包
[root@localhost ~]# yum install zabbix-server zabbix-web zabbix-server-mysql zabbix-web-mysql mariadb-server mariadb zabbix-agent -y
4.修改/etc/httpd/conf.d/zabbix.conf中的时区
php_value date.timezone Asia/Shanghai
5.启动数据库
systemctl start mariadb
6.创建zabbix数据库及用户
mysql create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to zabbix@localhost identified by '123456'; --------------------- 如果有如下报错 # MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by ‘123456‘; #ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your #MariaDB server version for the right syntax to use near '‘123456‘' at line 1 修改‘’为英文状态 ---------------------- flush privileges; exit;
7.进入/usr/share/doc/zabbix-server-mysql-3.2.6/目录
[root@localhost zabbix-server-mysql-3.2.6]# ls AUTHORS ChangeLog COPYING create.sql.gz NEWS README
8.导入数据
[root@localhost zabbix-server-mysql-3.2.6]# zcat create.sql.gz | mysql -uzabbix -p123456 zabbix
9.修改zabbix配置文件
vi /etc/zabbix/zabbix_server.conf 修改DBHost=localhost DBName=zabbix DBUser=zabbix DBPssword=123456
10.启动服务
systemctl start zabbix-server systemctl start httpd
11.配置防火墙(可选)
firewall-cmd --zone=public --add-service=http
12.web访问
点next step
13.确保没有no
14.输入数据库的相关信息,端口是0,就是默认的3306
15.填写名称然后下一步
16.完成
17.默认用户名密码是Admin/zabbix