1、LAMP 环境搭建

初次安装可以先关闭selinux 和 firewall

[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl stop firewalld.service 

1.1 mariadb数据库安装,启动、加入启动项

 [root@localhost ~]# yum install mariadb-*
 [root@localhost ~]# systemctl start mariadb.service
 [root@localhost ~]# systemctl status mariadb.service
 ● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled;
   vendor preset: disabled)
   Active: active (running) since 日 2019-02-24 11:10:49 CST; 16s
   ago
[root@localhost ~]# systemctl enable httpd.service
 

1.2 apache安装安装、启动、加入启动项

[root@localhost ~]# yum install httpd.x86_64
root@localhost ~]# systemctl start httpd.service
[root@localhost ~]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since 日 2019-02-24 11:19:16 CST; 5s ago

[root@localhost ~]# systemctl enable httpd.service 

  更改mysql root初始密码:

  mysql> set password for root@localhost = password('123');  

 mysql> flush privileges; #立即生效

 1.3 php 安装

[root@localhost ~]# yum install php.x86_64 

2、zabbix程序包安装部署

2.1 下载并安装zabbix  rpm包仓库

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

2.2 安装zabbix 相关程序包 

yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent #如果zabbix源慢,可以改变阿里源

2.4 安装初始化数据库

创建zabbix数据库,并对zabbix授予权限

MariaDB [(none)]> create database zabbix character set utf8;  #这里数据库一定要指定字符集,要不在前端历史操作是乱码,因为历史操作是保存在数据库里的。
MariaDB [(none)]>  flush privileges; 
MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by '111';

导入数据库

create.sql /usr/share/doc/zabbix-server-mysql-4.0.0

# mysql -u zabbix -p  zabbix < create.sql #导入create.sql 

 启动Zabbix Server进程

2.5 在zabbix_server.conf中编辑数据库配置

# vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

2.6 启动Zabbix Server进程,并加入启动项

# systemctl start zabbix-server# systemctl start zabbix-server.service
# systemctl status zabbix-server.service
● zabbix-server.service - Zabbix Server
Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; disabled; vendor preset: disabled)
Active: active (running) since 日 2019-02-24 15:59:37 CST; 6s ago# systemctl enable zabbix-server.service 

2.7 编辑Zabbix前端的PHP配置

Zabbix前端的Apache配置文件位于 /etc/httpd/conf.d/zabbix.conf 。一些PHP设置已经完成了配置。

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  #需要重启Apache Web服务器
# systemctl restart httpd.service

Zabbix前端可以在浏览器中通过 http://localhost/zabbix 访问

Centos 7.0 zabbix 部署-LMLPHP

zabbix登录默认用户名 密码: admin  zabbix 

zabbix安装完生成/etc/zabbix/web/zabbix.conf.php,可做数据库拆分配置用

 2.8 abbix_agentd.conf 配置

Server=127.0.0.1  #允许接受某主机发来的数据

ServerActive=127.0.0.1

启动zabbix_agentd

02-24 21:22