zabbix3.0.4安装部署文档
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zabbix3.0.4安装部署文档相关的知识,希望对你有一定的参考价值。
关于zabbix及相关服务软件版本:
Linux:centos 6.7 nginx:1.9.15 mysql:5.6 php:5.5.35
安装依赖包:
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. --user=www --group=www --with-http_ssl_module --with-http_v2_module --with-http_stub_status_module --with-pcre
make && make install
ln -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 install ln -s /usr/local/product/php-5.5.35 /usr/local/php1 cp php.ini-production /usr/local/php/etc/php.ini cd /usr/local/php1/etc/ cp php-fpm.conf.default php-fpm.conf 三、安装mysql 查看系统版本 cat /etc/redhat-release 2.下载 mysql 5.6包 3.添加用户和组 groupadd mysql useradd -g mysql mysql 4.安装mysql到/usr/local/mysql 下 cd /usr/local tar zxvf mysql…………………… 5.修改就压后文件名为mysql mv mysql………… mysql 6.修改mysql的各级文件夹和文件的创建者、创建组为mysql 注意点点... cd mysql chwon -R mysql . chgrp -R mysql . 7.至此mysql已经安装完了,但还需要初始化,初始化mysql表 test表 infaumation 表等 #scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 8.修改配置文件 cp support-files/mysql.server /etc/init.d/mysqld cp my.cnf /etc/mycnf vi /etc/my.cnf basedir = /usr/local/mysql datadir = /usr/local/mysql/data port = 3306 server_id = 1 9。启动mysql服务 ln -s /usr/local/mysql/bin/mysql /usr/bin service mysqld start mysql> SELECT user,host,password FROM mysql.user; +------+-----------+----------+ | user | host | password | +------+-----------+----------+ | root | localhost | | | root | 10-4-5-9 | | | root | 127.0.0.1 | | | root | ::1 | | | | localhost | | | | 10-4-5-9 | | +------+-----------+----------+ 6 rows in set (0.00 sec) mysql> UPDATE mysql.user set password = PASSWORD(‘gechong‘) WHERE user = ‘root‘; mysql> DROP USER ‘‘@localhost; mysql> FLUSH PRIVILEGES; chkconfig --add mysqldd chkconfig mysqld on service mysqld start ysql> create database zabbix default charset utf8; Query OK, 1 row affected (0.00 sec) mysql> grant all privileges on zabbix.* to [email protected]‘localhost‘ identified by ‘zabbix‘; Query OK, 0 rows affected (0.03 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) 四、安装zabbix 1.tar -zxvf zabbix-3.0.4.tar.gz && cd zabbix-3.0.4 编译zabbix ./configure --prefix=/usr/local/zabbix-3.0.4/ --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 make make install echo $? (若为0 安装完成) 在这里遇到两个包需要安装 yum install -y mysql-devel net-snmp-devel 2.创建zabbix用户 [[email protected] zabbix-3.0.4]# groupadd zabbix [[email protected] zabbix-3.0.4]# useradd zabbix -s /sbin/nologin -M -g zabbix 3.导入数据 [[email protected] zabbix-3.0.4]# mysql -uroot -pabc123 zabbix < database/mysql/schema.sql [[email protected] zabbix-3.0.4]# mysql -uroot -pabc123 zabbix < database/mysql/images.sql [[email protected] zabbix-3.0.4]# mysql -uroot -pabc123 zabbix < database/mysql/data.sql 4.创建网站目录 [[email protected] zabbix-3.0.4]# mkdir /data/web/zabbix.lifec.com -p [[email protected] zabbix-3.0.4]# mkdir /data/logs/zabbix -p [[email protected] zabbix-3.0.4]# cp -rp frontends/php/* /data/web/zabbix.lifec.com/ 5.编辑虚拟主机 [[email protected] conf]# mkdir extra [[email protected] conf]# cd extra/ [[email protected] extra]# ls [[email protected] extra]# vim zabbix.conf 添加如下内容 server { listen 8027; server_name zabbix.lifec.com; access_log /data/logs/zabbix/zabbix.lifec.com.access.log main; index index.html index.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; } } 6.编辑nginx配置文件 在nginx.conf末尾加上 include extra/*.conf; 7.编辑zabbix_server.conf LogFile=/tmp/zabbix_server.log PidFile=/tmp/zabbix_server.pid DBHost=localhost DBName=zabbix DBUser=root DBPassword=abc123 8.启动服务 /usr/local/nginx/sbin/nginx /usr/local/php1/sbin/php-fpm /usr/local/zabbix-3.0.4/sbin/zabbix_server 9.web端访问zabbix 192.168.2.200:8027 至此zabbix准备工作完成,下一步进行配置
以上是关于zabbix3.0.4安装部署文档的主要内容,如果未能解决你的问题,请参考以下文章