码迷,mamicode.com
首页 > 其他好文 > 详细

1 zabbix3.2.4 安装

时间:2017-11-02 16:10:13      阅读:273      评论:0      收藏:0      [点我收藏+]

标签:ldb   root密码   hang   blog   安装zabbix   直接   服务端   zabbix3.0   run   

一. 搭建zabbix服务

Zabbix 3.0对PHP的要求最低为5.4,而CentOS6默认为5.3.3,完全不满足要求,故需要利用第三方源,将PHP升级到5.4以上,注意,不支持PHP7。如下是zabbix服务端搭建过程
 
环境:centos6.5  
zabbix-server: 192.168.9.28
 
1.安装php
[root@localhost ~]# rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm
[root@localhost ~]# yum -y install php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap
[root@localhost ~]# cp /etc/php.ini /etc/php.ini.org
[root@localhost ~]# vim /etc/php.ini
889 date.timezone = Asia/Shanghai
663 post_max_size = 32M
375 max_execution_time = 300
385 max_input_time = 300
705 always_populate_raw_post_data = -1
 
2.安装mysql
mysql建议用5.6版本,centos自带为5.1,不建议使用,性能偏低
[root@localhost ~]# rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
[root@localhost ~]# yum -y install  mysql-server mysql-devel
[root@localhost ~]# egrep -v ‘#|$^‘ /etc/my.cnf    // mysql的配置,可以直接用
[mysqld]
innodb_file_per_table
datadir =  /data/mysqldb
port = 3306
log_error = /data/mysqldb/error.log
log-bin=/data/mysqldb/mysql-bin
socket = /var/lib/mysql/mysql.sock
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[root@localhost ~]# mkdir -pv /data/mysqldb
[root@localhost mysqldb]# chown -R mysql:mysql /data/
[root@localhost ~]# /etc/init.d/mysqld start
[root@localhost ~]# ps -ef | grep mysql
root     10166     1  0 09:46 pts/0    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/data/mysqldb --socket=/data/mysqldb/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
mysql    10373 10166  4 09:46 pts/0    00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/data/mysqldb --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/data/mysqldb/error.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/data/mysqldb/mysql.sock --port=3306
root     10401  9342  0 09:46 pts/0    00:00:00 grep mysql
[root@localhost ~]# netstat -lnpt | grep 3306
tcp        0      0 :::3306                     :::*                        LISTEN      10373/mysqld      

root@localhost mysqldb]# mysql

Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.6.38-log MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql>

mysql> create database zabbix character set utf8;

mysql>  GRANT ALL PRIVILEGES ON *.* TO zabbix@localhost IDENTIFIED BY ‘zabbix‘;

mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)

mysql> show databases;

技术分享

4 rows in set (0.00 sec)

 

[root@localhost mysqldb]# mysql -uzabbix -pzabbix   //登陆测试

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql>

注:若创建了mysql的root密码,必须用root登陆mysql后,给zabbix用户在这台机器上授权,让zabbix用户能够连接所用库,否则启动zabbix_server 时报错,在浏览器打开时也显示zabbix_server没有运行。授权zabbix用户时输入zabbix用户的密码。命令如下:
 
 技术分享

3.安装zabbix

 [root@localhost ~]# yum - y install httpd libxml2-devel net-snmp-devel libcurl-devel

[root@localhost mysqldb]# groupadd -g 201 zabbix
[root@localhost mysqldb]# useradd -g zabbix -u 201 -m zabbix

[root@localhost mysqldb]# cd /root/soft
[root@localhost soft]# ls
zabbix-3.2.4.tar.gz

[root@localhost soft]# tar xf zabbix-3.2.4.tar.gz -C /usr/src/

[root@localhost soft]# cd /usr/src/zabbix-3.2.4/
[root@localhost zabbix-3.2.4]# mysql -uzabbix -pzabbix zabbix < ./database/mysql/schema.sql

[root@localhost zabbix-3.2.4]# mysql -uzabbix -pzabbix zabbix < ./database/mysql/
images.sql

[root@localhost zabbix-3.2.4]# mysql -uzabbix -pzabbix zabbix < ./database/mysql/
data.sql

[root@localhost zabbix-3.2.4]# yum -y install gcc gcc-c++ make

[root@localhost zabbix-3.2.4]# ./configure --prefix=/usr/local/zabbix --sysconfdir=/etc/zabbix/ --enable-server --enable-agent --with-net-snmp --with-libcurl --with-mysql --with-libxml2

[root@localhost zabbix-3.2.4]# make && make install

注:编译 zabbix 如果报下面错误,就做以下操作 configure: error: Not found mysqlclient library

[root@localhost zabbix-3.2.4]#find / -name libmysqlclient*
[root@localhost zabbix-3.2.4]#
ln -s /usr/lib64/mysql/libmysqlclient.so.18.1.0 /usr/lib64/mysql/libmysqlclient.so
[root@localhost zabbix-3.2.4]#
ln -s /usr/lib64/mysql/libmysqlclient_r.so.18.1.0 /usr/lib64/mysql/libmysqlclient_r.so)


4. 配置zabbix

[root@localhost zabbix-3.2.4]# cp /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf.org
[root@localhost zabbix-3.2.4]# vim /etc/zabbix/zabbix_server.conf

77 DBHost=192.168.9.28   //数据库ip地址

85 DBName=zabbix

102 DBUser=zabbix

298 ListenIP=127.0.0.1,192.168.9.28   //zabbix_server地址

[root@localhost zabbix-3.2.4]# ln -s /usr/local/zabbix/sbin/* /usr/sbin/

[root@localhost zabbix-3.2.4]# cp -r /usr/src/zabbix-3.2.4/misc/init.d/fedora/core/zabbix_* /etc/init.d/

[root@localhost zabbix-3.2.4]# chmod +x /etc/init.d/zabbix_*

[root@localhost zabbix-3.2.4]# sed -i "s@BASEDIR/usr/local@BASEDIR=/usr/local/zabbix@g" /etc/init.d/zabbix_server
 
 
5.创建zabbix_agentd 服务
Agent的作用就是获得host数据,然后将收集到的数据发送给server,或者sever主动来拿数据
[root@localhost zabbix]# pwd
/etc/zabbix
[root@localhost zabbix]# cp zabbix_agentd.conf zabbix_agentd.conf.origin
[root@localhost zabbix]# vim zabbix_agentd.conf
123 ServerActive=192.168.9.28:10051  //服务器端IP ,端口固定
21 LogFile=/var/log/zabbix/zabbix_agentd.log
82 Server=127.0.0.1,192.168.9.28   //服务端IP地址
228  UnsafeUserParameters=1   //自定义脚本功能,1为开启,默认0为关闭
216  Include=/etc/zabbix/zabbix_agentd.conf.d/  //自定义的agent配置文件存放路径
[root@localhost zabbix]# vim /etc/init.d/zabbix_agentd
 21         # Zabbix-Directory
 22         BASEDIR=/usr/local/zabbix
[root@localhost zabbix]# /etc/init.d/zabbix_agentd start
[root@localhost frontends]# netstat -lnpt | grep zabbix_*
tcp        0      0 0.0.0.0:10050               0.0.0.0:*                   LISTEN      20806/zabbix_agentd
 
 
 
6.部署PHP 页面文档
[root@localhost zabbix-3.2.4]# pwd
/usr/src/zabbix-3.2.4
[root@localhost zabbix-3.2.4]# mkdir -pv /var/www/html/zabbix
[root@localhost zabbix-3.2.4]# cp -rf frontends/php/ /var/www/html/zabbix
[root@localhost zabbix-3.2.4]# chown -R apache.apache /var/www/html/zabbix/
[root@localhost zabbix-3.2.4]#  /etc/init.d/httpd start
 
 
 
7.配置web页面
[root@localhost zabbix-3.2.4]# vim /etc/httpd/conf/httpd.conf
 276 ServerName 127.0.0.1
 277 ServerName 192.168.9.28
293 DocumentRoot "/var/www/html"
[root@localhost zabbix-3.2.4]# mkdir -p /var/www/html/zabbix
[root@localhost zabbix-3.2.4]# chown -R apache.apache /var/www/html/zabbix

[root@localhost zabbix-3.2.4]# chkconfig zabbix_server on

[root@localhost ~]# service zabbix_server start

 

8.浏览器访问zabbix,并按照提示安装

http://192.168.9.28/zabbix

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

输入用户名密码  Admin/zabbix

 

 至此,zabbix3.0 搭建完成

 
 
 
 
 

1 zabbix3.2.4 安装

标签:ldb   root密码   hang   blog   安装zabbix   直接   服务端   zabbix3.0   run   

原文地址:http://www.cnblogs.com/lzcys8868/p/7772133.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!