Zabbix3.0安装文档

******************************************************************

关于zabbix及相关服务软件版本:

Linux:centos 6.6

nginx:1.9.15

MySQL:5.5.49

PHP:5.5.35

一、安装nginx:

安装依赖包:

yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre* make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel
 

创建用户:

useradd nginx -s /sbin/nologin -M
 

下载nginx软件包并进入到目录中:

wget http://nginx.org/download/nginx-1.9.15.tar.gz && tar xvf nginx-1.9.15.tar.gz && cd nginx-1.9.15

编译:

./configure --prefix=/usr/local/product/nginx1.9.14 --user=www --group=www --with-http_ssl_module --with-http_v2_module --with-http_stub_status_module --with-pcre
make && make installln -s /usr/local/product/nginx1.9.14 /usr/local/nginx    ==>创建软链接

参数解释:

--with-http_stub_status_module:支持nginx状态查询
--with-http_ssl_module:支持https
--with-http_spdy_module:支持google的spdy,想了解请百度spdy,这个必须有ssl的支持
--with-pcre:为了支持rewrite重写功能,必须制定pcre

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

二、安装PHP

下载PHP安装包:

wget http://cn2.php.net/get/php-5.5.35.tar.gz/from/this/mirror

解压并编译:

mv mirror php-5.5.35.tar.gz && tar xvf php-5.5.35.tar.gz && cd php-5.5.35
 
./configure --prefix=/usr/local/product/php-5.5.35 --with-config-file-path=/usr/local/product/php-5.5.35/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath

make && make installln -s /usr/local/product/php-5.5.35 /usr/local/php

cp php.ini-production /usr/local/php/etc/php.inicd /usr/local/php/etc/

cp php-fpm.conf.default php-fpm.conf

修改php.ini参数:(zabbix环境需要修改的参数)

max_execution_time= 300

memory_limit =128M

post_max_size =16M

upload_max_filesize= 2M

max_input_time =300

date.timezone =PRC

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

三、安装MySQL

添加mysql用户,创建mysql的数据目录:

groupadd mysql

mkdir -pv/data/mysql

useradd -r -gmysql -d /data/mysql -s /sbin/nologin mysql

chown -Rmysql.mysql /data/mysql

安装cmake及依赖:

yum install cmakegcc* ncurses-devel -y

下载MySQL安装包:

wgethttp://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.49.tar.gz

编译安装MySQL

tar -xvfmysql-5.5.49.tar.gz && cd mysql-5.5.49

cmake-DCMAKE_INSTALL_PREFIX=/usr/local/product/mysql5.5.49 -DDEFAULT_CHARSET=utf8-DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql -DWITH_EXTRA_CHARSETS=all-DWITH_READLINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=3306-DDEFAULT_COLLATION=utf8_general_ci

make && make install

ln -s /usr/local/product/mysql5.5.49 /usr/local/mysql

chown -R mysql.mysql /usr/local/mysql

拷贝mysql的配置文件:

cd/usr/local/mysql/support-files/

cp my-medium.cnf/data/mysql/my.cnf

cp mysql.server/etc/init.d/mysqld

chmod +x/etc/init.d/mysqld

初始化MySQL

cd/usr/local/mysql/scripts

./mysql_install_db--user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql/

修改MySQL配置文件my.cnf中数据目录:

datadir=/data/mysql/

启动MySQL

[[email protected] ~]#/etc/init.d/mysqld start

Starting MySQL...SUCCESS!

登录数据库,创建zabbix数据库及用户名和密码:

yum installmysql-server –y

service mysqldrestart

mysql> createdatabase zabbix default charset utf8;

Query OK, 1 rowaffected (0.00 sec)

mysql> grantall privileges on zabbix.* to [email protected]‘localhost‘ identified by ‘zabbix‘;

Query OK, 0 rowsaffected (0.03 sec)

mysql> flushprivileges;

Query OK, 0 rows affected(0.00 sec)

mysql> showdatabases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| zabbix |
+--------------------+
5 rows in set (0.00 sec)

如果登录数据库出现问题:

[[email protected] ~]#mysql

ERROR 2002(HY000): Can‘t connect to local MySQL server through socket‘/var/lib/mysql/mysql.sock‘ (2)

解决办法:

[[email protected] ~]#ln -s /tmp/mysql.sock /var/lib/mysql/

为数据库的root创建密码:

[[email protected]]# mysqladmin -uroot password "zabbix"

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

四、安装zabbixserver:

安装zabbix:

-rw-r--r--   1 root root  15407273 5月  21 2016 zabbix-3.0.3.tar.gz
 
[[email protected] ~]# tar zxf zabbix-3.0.3.tar.gz && cd zabbix-3.0.3
 
编译zabbix:
 
./configure --prefix=/usr/local/zabbix-3.0.3/ --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
 
 
make && make install

编译过程中如果有报错:

故障:

checking formysql_config... no

configure: error:MySQL library not found

解决:

yum installmysql-devel -y

故障:

checking fornet-snmp-config... no

configure: error:Invalid Net-SNMP directory - unable to find net-snmp-config

解决:

yum installnet-snmp-devel -y

创建zabbix用户:

[[email protected]]# groupadd zabbix

[[email protected]]# useradd zabbix -s /sbin/nologin -M -g zabbix

zabbix server需要导入3sql文件:

[[email protected]]# mysql -uroot -pzabbix zabbix < database/mysql/schema.sql

[[email protected]]# mysql -uroot -pzabbix zabbix < database/mysql/images.sql

[[email protected]]# mysql -uroot -pzabbix zabbix < database/mysql/data.sql

[[email protected] zabbix-3.0.3]# pwd
  /root/zabbix-3.0.3

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

五、zabbix管理网站配置(nginx):

创建项目目录:

[[email protected]]# mkdir /data/web/zabbix.lifec.com -p

[[email protected]]# mkdir /data/logs/zabbix -p

将前端文件拷贝到项目目录下:

[[email protected]]# cp -rp frontends/php/* /data/web/zabbix.lifec.com/

编辑nginx虚拟主机:

# pwd

/usr/local/nginx/conf

[[email protected]]# mkdir extra

[[email protected]]# cd extra/

[[email protected]]# vim zabbix.conf

server {

listen 80;

server_namezabbix.lifec.com;

access_log/data/logs/zabbix/zabbix.lifec.com.access.log main;

index index.htmlindex.php index.html;

root/data/web/zabbix.lifec.com;

location /{

try_files $uri $uri/ /index.php?$args;

}

location ~^(.+.php)(.*)$ {

fastcgi_split_path_info ^(.+.php)(.*)$;

include fastcgi.conf;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param PATH_INFO$fastcgi_path_info;

}

}

编辑nginx.conf配置文件:

[[email protected]]# cat nginx.conf

user  nginx;

worker_processes  1;

#error_log  logs/error.log warning;

#error_log  logs/error.log  notice;

#error_log  logs/error.log  info;

pid        logs/nginx.pid;

events {

worker_connections  1024;

}

http {

include       mime.types;

default_type  application/octet-stream;

log_format main  ‘$remote_addr - $remote_user[$time_local] "$request" ‘

‘$status $body_bytes_sent"$http_referer" ‘

‘"$http_user_agent" "$http_x_forwarded_for"‘;

access_log logs/access.log  main;

sendfile       on;

#tcp_nopush     on;

#keepalive_timeout  0;

keepalive_timeout  65;

#gzip on;

include extra/*.conf;

}

编辑zabbix_server.conf文件:

[[email protected] etc]#pwd
/usr/local/zabbix-3.0.2/etc

LogFile=/tmp/zabbix_server.log

PidFile=/tmp/zabbix_server.pid

DBHost=localhost

DBName=zabbix

DBUser=zabbix

DBPassword=zabbix

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

六、启动服务

启动nginx

[[email protected]]# /usr/local/nginx/sbin/nginx

启动PHP

[[email protected]]# /usr/local/php/sbin/php-fpm

启动zabbix server

[[email protected] conf]#/usr/local/zabbix-3.0.3/sbin/zabbix_server

如果启动的时候报错:

[[email protected] ~]# /usr/local/zabbix-3.0.2/sbin/zabbix_server
  /usr/local/zabbix-3.0.2/sbin/zabbix_server: error while loading sharedlibraries: libmysqlclient.so.18: cannot open shared object file: No such fileor directory

[[email protected] ~]# ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/

添加/etc/hosts文件:

Server-ipzabbix.lifec.com

查看服务端口:

[[email protected]]# netstat -lntup

Active Internetconnections (only servers)

Proto Recv-QSend-Q Local Address              Foreign Address            State       PID/Program name

tcp        0     0 0.0.0.0:22                 0.0.0.0:*                   LISTEN      1029/sshd

tcp        0     0 0.0.0.0:8027               0.0.0.0:*                   LISTEN      3730/nginx

tcp        0     0 0.0.0.0:10051              0.0.0.0:*                   LISTEN      3743/zabbix_server

tcp        0     0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      3736/php-fpm

tcp        0     0 0.0.0.0:3306               0.0.0.0:*                   LISTEN      24922/mysqld

tcp        0     0 :::22                      :::*                        LISTEN      1029/sshd

udp        0     0 0.0.0.0:68                 0.0.0.0:*                              880/dhclient

将服务加入开机自启动:

[[email protected] ~]#echo "/usr/local/nginx/sbin/nginx" >>/etc/rc.local

[[email protected] ~]#echo "/usr/local/php/sbin/php-fpm" >>/etc/rc.local

[[email protected] ~]#echo "/etc/init.d/mysqld start" >>/etc/rc.local

[[email protected] ~]#echo "/usr/local/zabbix-3.0.3/sbin/zabbix_server">>/etc/rc.local

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

七、web端配置zabbix

Zabbix-web界面:

......

修改界面为中文界面

默认登录界面为英文:

修改以下配置,并重启服务即可;

vim/data/web/zabbix.lifec.com/include/locales.inc.php
      #‘zh_CN‘ => [‘name‘ => _(‘Chinese (zh_CN)‘),‘display‘ => false],
      ‘zh_CN‘ => [‘name‘ => _(‘Chinese (zh_CN)‘),‘display‘ => true],

##############################################################################################################################################################

*Installing Zabbix Agent

Follow the below instructions to install Zabbix Agent on CentOS, RHEL 7/6/5 systems

# rpm -Uvh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm

# yum install zabbix-agent

#vim /etc/zabbix/zabbix_agentd.conf

#Server=[zabbix server ip]

#ServerActive=[zabbix server ip]

#Hostname=[Hostname of client system]

Server=Zabbix Server IP

ServerActive=Zabbix Server IP

Hostname=AgentName

# /etc/init.d/zabbix-agent start

# chconfig zabbix-agent on

Zabbix_web[乱码]

#cd/etc/yum.repos.d/

#wgethttp://mirrors.aliyun.com/repo/epel-6.repo

#yum-y install wqy-microhei-fonts

#cp/usr/share/fonts/wqy-microhei/wqy-microhei.ttc/data/web/zabbix.lifec.com/fonts/DejaVuSans.ttf

刷新页面

---------》 prefect!

时间: 2024-10-11 10:51:08

Zabbix3.0安装文档的相关文章

ORACLE LINUX 6.3 + ORACLE 11.2.0.3 RAC + VBOX安装文档

ORACLE LINUX 6.3 + ORACLE 11.2.0.3 RAC + VBOX安装文档 2015-10-21 12:51 525人阅读 评论(0) 收藏 举报  分类: Oracle RAC 版权声明:本文为博主原创文章,未经博主允许不得转载. VBOX + Oracle Linux 6U3 + ORACLE 11.2.0.3.0 RAC 安装 环境: 虚拟机          VIRTUAL BOX OS                ORACLE LINUX 6.3_X86_64

[译文]Casperjs1.1.0参考文档-安装

安装 Casperjs能被安装在mac osx,windows 和大多数linux版本 依赖项 PhantomJS1.82及以上 Python2.6及以上 1.1版本的新特性 试验性的:在1.1-beta1版本,slimerjs 0.8及以上版本可以在 gecko(firefox)内核上运行你的测试.(仅需要在执行语句命令行中增加–engine=slimerjs这个参数) Mac osx下安装 略 Npm安装 略 从git安装 略 从一个档案安装 你可以从此处下载源代码: 最近的开发版: htt

_00024 尼娜抹微笑伊拉克_云计算ClouderaManager以及CHD5.1.0群集部署安装文档V1.0

笔者博文:妳那伊抹微笑 itdog8 地址链接 : http://www.itdog8.com(个人链接) 博客地址:http://blog.csdn.net/u012185296 博文标题:_00024 妳那伊抹微笑_云计算之ClouderaManager以及CHD5.1.0集群部署安装文档V1.0 个性签名:世界上最遥远的距离不是天涯,也不是海角.而是我站在妳的面前.妳却感觉不到我的存在 技术方向:Flume+Kafka+Storm+Redis/Hbase+Hadoop+Hive+Mahou

_00024 妳那伊抹微笑_云计算之ClouderaManager以及CHD5.1.0集群部署安装文档V1.0

博文作者:妳那伊抹微笑 博客地址:http://blog.csdn.net/u012185296 博文标题:_00024 妳那伊抹微笑_云计算之ClouderaManager以及CHD5.1.0集群部署安装文档V1.0 个性签名:世界上最遥远的距离不是天涯,也不是海角,而是我站在妳的面前,妳却感觉不到我的存在 技术方向:Flume+Kafka+Storm+Redis/Hbase+Hadoop+Hive+Mahout+Spark ... 云计算技术 转载声明:可以转载, 但必须以超链接形式标明文章

OEM12C安装文档

OEM12C安装文档 环境:OEM12.1.0.5 操作系统:CENTOS6.7 ORACLE:11.2.0.3 1.硬件要求 2.软件包要求 ----RHEL6.X OEL6.X版本 for oms make-3.81 binutils-2.20.51.0.2-5.11 gcc-4.4.4 libaio-0.3.107 glibc-common-2.12-1 libstdc++-4.4.4 libXtst-1.0.99.2-3.el6.x86_ 64.rpm sysstat-9.0.4 gli

zabbix专题:第二章 zabbix3.0安装详解

zabbix3.0安装详解 本节目录大纲 安装配置mariadb 安装服务器端 zabbix web配置 web页面初始化 更改为中文 中文乱码问题 zabbix专题:第二章 zabbix3.2安装详解 zabbix专题:第二章 zabbix3.2安装详解 官方文档地址: https://www.zabbix.com/documentation/3.2/manual/installation/install_from_packages 我安装zabbix用的rpm包,可以从官网的源里面去下载,需

Visual studio 2010不能安装文档

问题:visual studio 2010重新安装过程中不能安装文档,显示无权限获得文档: 点击ok后,冲本地磁盘或者联网安装帮助文档,会出现灰色不可选的安装路径 解决: 通过修改Helplibmanager的配置文件HelpLibManager.exe.config,该文件在目录系统盘下C:\Program Files\Microsoft Help Viewer\v1.0 编辑配置文件 HelpLibManager.exe.config, 修改<add key="FirstTimeRun

Nginx 安装文档 (二)PHP

下载.编译安装 wget http://cn2.php.net/distributions/php-5.4.7.tar.gz tar zvxf php-5.4.7.tar.gz cd php-5.4.7 ./configure --prefix=/usr/local/php  --enable-fpm --with-mcrypt --enable-mbstring --disable-pdo --with-curl --disable-debug  --disable-rpath --enabl

Nginx 安装文档

一.下载软件 wget http://nginx.org/download/nginx-1.6.0.tar.gz 安装 用于 RedHat 系发行版 (RHEL, CentOS, Fedora). 本维基站点的服务器就是以此选项编译. 首先安装需求包: yum install gccopenssl-devel pcre-devel zlib-devel 添加用户 useradd –d /usr/local/nginx -s /sbin/nologin nginx tar zxvf nginx-1