joeykandy / coderbook

0 stars 0 forks source link

CentOS 7 下快速搭建 Zabbix 3.0 环境 #2

Open joeykandy opened 7 years ago

joeykandy commented 7 years ago

安装环境准备

系统版本:CentOS Linux release 7.3.1611 (Core) 内核版本:3.10.0-514.el7.x86_64 Httpd版本:httpd-2.4.6-45.el7.centos.4.x86_64 MariaDB版本:5.5.52-MariaD PHP版本:5.4.16-42.el7.x86_64

关闭selinux,防火墙

[root@localhost ~]# vi /etc/selinux/config SELINUX=disabled

[root@localhost ~]# systemctl stop firewalld [root@localhost ~]# systemctl disable firewalld

zabbix 安装

下载安装源

[root@localhost ~]# wget http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm [root@localhost ~]# rpm -ivh zabbix-release-3.0-1.el7.noarch.rpm

安装zabbix

mysql和MariaDB安装zabbix-server-mysql zabbix-web-mysql, PostgreSQL安装zabbix-server-pgsql zabbix-web- pgsql 。

[root@localhost ~]# yum install zabbix-server-mysql zabbix-web-mysql zabbix-get zabbix-agent

MariaDB安装:

[root@localhost ~]# yum install mariadb-server [root@localhost ~]# vi /etc/my.cnf.d/server.cnf [mysqld] character-set-server = utf8 collation-server = utf8_bin skip-character-set-client-handshake skip-external-locking symbolic-links=0 innodb_buffer_pool_size = 2048M innodb_log_file_size = 512M sort_buffer_size = 2M innodb_additional_mem_pool_size = 30M innodb_log_buffer_size = 8M key_buffer_size = 16M log-bin=mysql-bin expire_logs_days = 7 server-id=1001 innodb_data_file_path = ibdata1:1G innodb_file_per_table

启动mariaDB并设开机启动

[root@localhost ~]# systemctl start mariadb [root@localhost ~]# systemctl enable mariadb

初始数据库导入以及zabbix配置:

数据库中创建zabbix的数据库和账号

[root@localhost ~]# mysql -uroot MariaDB [(none)]> create database zabbix; MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix' ; MariaDB [(none)]> exit

导入初始表

[root@localhost ~]# zcat /usr/share/doc/zabbix-server-mysql-3.0.9/create.sql.gz | mysql -uroot zabbix

配置zabbix

[root@localhost ~]# vi /etc/zabbix/zabbix_server.conf DBPassword=zabbix

配置Http

[root@localhost ~]# vi /etc/httpd/conf.d/zabbix.conf php_value date.timezone Asia/Shanghai

设置开机启动

[root@localhost ~]# systemctl start zabbix-server [root@localhost ~]# systemctl start zabbix-agent [root@localhost ~]# systemctl start httpd [root@localhost ~]# systemctl enable zabbix-server [root@localhost ~]# systemctl enable zabbix-agent [root@localhost ~]# systemctl enable httpd

安装完成

打开浏览器,键入http:/serverIP/zabbix

一路点next,最后出现登录画面,默认账号是Admin,密码是zabbix

Database port输入3306

至此,zabbix服务器安装完成。