本文共 4168 字,大约阅读时间需要 13 分钟。
搭建环境
centos 7.2httpd2.4mysql5.6zabbix3.01, 查看系统环境
[root@zabbix ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core)[root@zabbix ~]# uname -aLinux 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/Linux2.使用rpm命令安装zabbix 3.0最新的epel源,关闭selinux和iptables。[root@zabbix ~]# rpm -ivh [root@zabbix ~]# systemctl stop firewalld.service[root@zabbix ~]# setenforce 0setenforce: SELinux is disabled3.利用epel源安装zabbixserver所需软件包。[root@zabbix ~]# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get -y4.安装并且启动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 mysqlroot 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=mysqlmysql 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.sockroot 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.log49 LogFileSize=072 PidFile=/var/run/zabbix/zabbix_server.pid81 DBHost=localhost91 DBName=zabbix107 DBUser=zabbix115 DBPassword=zabbix7.修改配置文件/etc/httpd/conf.d/zabbix.conf 此处为修改php 文件
13 php_value max_execution_time 300
14 php_value memory_limit 128M15 php_value post_max_size 16M16 php_value upload_max_filesize 2M17 php_value max_input_time 30018 php_value always_populate_raw_post_data -119 php_value date.timezone Asia/Shanghai9.开启apache服务[root@zabbix zabbix-server-mysql-3.0.14]# systemctl start httpd[root@zabbix zabbix-server-mysql-3.0.14]# systemctl enable httpdCreated 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 -DFOREGROUNDapache 11006 11005 0 21:30 ? 00:00:00 /usr/sbin/httpd -DFOREGROUNDapache 11007 11005 0 21:30 ? 00:00:00 /usr/sbin/httpd -DFOREGROUNDapache 11008 11005 0 21:30 ? 00:00:00 /usr/sbin/httpd -DFOREGROUNDapache 11009 11005 0 21:30 ? 00:00:00 /usr/sbin/httpd -DFOREGROUNDapache 11010 11005 0 21:30 ? 00:00:00 /usr/sbin/httpd -DFOREGROUNDroot 11054 9531 0 21:31 pts/0 00:00:00 grep --color=auto httpd10.访问网站,例如http://127.0.0.1/zabbix,如下图所示:
11.选择下一步,Check of pre-requisites,如图所示:
12.选择下一步,配置数据库配置文件,如下图所示: 密码zabbix
13.选择下一步,配置zabbix server detail,如下图所示:
14.点击下一步,便完成安装,安装完成的界面如下图所示:
15, zabbix 安装完成会显示安装成功界面和密码路径
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,如图所示:18, zbbix 登录成功转载于:https://blog.51cto.com/xia1314520ting/2063471