博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CentOS 7 搭建zabbix3.0
阅读量:6780 次
发布时间:2019-06-26

本文共 4168 字,大约阅读时间需要 13 分钟。

搭建环境

centos 7.2
httpd2.4
mysql5.6
zabbix3.0

1, 查看系统环境

[root@zabbix ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@zabbix ~]# uname -a
Linux zabbix 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
2.使用rpm命令安装zabbix 3.0最新的epel源,关闭selinux和iptables。
[root@zabbix ~]# rpm -ivh
[root@zabbix ~]# systemctl stop firewalld.service
[root@zabbix ~]# setenforce 0
setenforce: SELinux is disabled
3.利用epel源安装zabbixserver所需软件包。
[root@zabbix ~]# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get -y
4.安装并且启动mysql5.6,创建zabbix数据库。
[root@zabbix ~]# rpm -ivh
[root@zabbix ~]# yum install -y mysql-community-server
[root@zabbix ~]# systemctl start mysqld
[root@zabbix ~]# systemctl enable mysqld 开机自启
mysqld.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig mysqld on
[root@zabbix ~]# ps -ef | grep mysql
root 10125 1 0 21:17 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
mysql 10329 10125 0 21:17 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
root 10426 9531 0 21:18 pts/0 00:00:00 grep --color=auto mysql
[root@zabbix ~]# mysql -uroot -p
Enter password: 无密码回车即可

mysql> create database zabbix character set utf8 collate utf8_bin;

Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';

Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

mysql> quit

5.导入默认的zabbix数据库信息。 导入数据库没有任何提示

[root@zabbix ~]# cd /usr/share/doc/zabbix-server-mysql-3.0.14/
[root@zabbix zabbix-server-mysql-3.0.14]# zcat create.sql.gz | mysql -uroot zabbix
[root@zabbix zabbix-server-mysql-3.0.14]# 返回当前界面表示导入成功

6.修改zabbix_server.conf的配置文件。

[root@zabbix zabbix-server-mysql-3.0.14]# vim /etc/zabbix/zabbix_server.conf

38 LogFile=/var/log/zabbix/zabbix_server.log
49 LogFileSize=0
72 PidFile=/var/run/zabbix/zabbix_server.pid
81 DBHost=localhost
91 DBName=zabbix
107 DBUser=zabbix
115 DBPassword=zabbix

7.修改配置文件/etc/httpd/conf.d/zabbix.conf 此处为修改php 文件

13 php_value max_execution_time 300

14 php_value memory_limit 128M
15 php_value post_max_size 16M
16 php_value upload_max_filesize 2M
17 php_value max_input_time 300
18 php_value always_populate_raw_post_data -1
19 php_value date.timezone Asia/Shanghai
9.开启apache服务
[root@zabbix zabbix-server-mysql-3.0.14]# systemctl start httpd
[root@zabbix zabbix-server-mysql-3.0.14]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

[root@zabbix zabbix-server-mysql-3.0.14]# ps -ef | grep httpd

root 11005 1 0 21:30 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11006 11005 0 21:30 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11007 11005 0 21:30 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11008 11005 0 21:30 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11009 11005 0 21:30 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 11010 11005 0 21:30 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
root 11054 9531 0 21:31 pts/0 00:00:00 grep --color=auto httpd

10.访问网站,例如http://127.0.0.1/zabbix,如下图所示:

CentOS 7 搭建zabbix3.0

11.选择下一步,Check of pre-requisites,如图所示:

CentOS 7 搭建zabbix3.0

12.选择下一步,配置数据库配置文件,如下图所示: 密码zabbix

CentOS 7 搭建zabbix3.0

13.选择下一步,配置zabbix server detail,如下图所示:

CentOS 7 搭建zabbix3.0

14.点击下一步,便完成安装,安装完成的界面如下图所示:

CentOS 7 搭建zabbix3.0

15, zabbix 安装完成会显示安装成功界面和密码路径

CentOS 7 搭建zabbix3.0

16, 查看安装完成的zabbix 密码账号

[root@zabbix ~]# cat /etc/zabbix/web/zabbix.conf.php
<?php
// Zabbix GUI configuration file.
global $DB;

$DB['TYPE'] = 'MYSQL';

$DB['SERVER'] = 'localhost';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'zabbix';

// Schema name. Used for IBM DB2 and PostgreSQL.

$DB['SCHEMA'] = '';

$ZBX_SERVER = 'localhost';

$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = '';

$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;

17.Zabbix·server的默认账号Admin 密码zabbix,如图所示:
CentOS 7 搭建zabbix3.0
18, zbbix 登录成功
CentOS 7 搭建zabbix3.0

转载于:https://blog.51cto.com/xia1314520ting/2063471

你可能感兴趣的文章