Ubuntu16.04安装部署监控系统Zabbix2.4

前端之家收集整理的这篇文章主要介绍了Ubuntu16.04安装部署监控系统Zabbix2.4前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Ubuntu16.04安装部署监控系统Zabbix2.4

第一部分,PHP+MysqL+Nginx组件安装

1、系统更新

sudo apt-get update && sudo apt-get upgrade


2、安装PHP-fpm

检索系统当前自带PHP版本:apt-cache search PHP-fpm

安装依赖包:sudo apt-get install make bison g++ build-essential libncurses5-dev cmake

安装PHP-fpm:sudo apt-get install PHP7.0-fpm

编辑修改配置文件:vim /etc/PHP/7.0/fpm/PHP.ini

post_max_size = 16M

max_execution_time = 300

max_input_time = 300

date.timezone = Asia/Shanghai

启动PHP-fpm: service PHP7.0-fpm restart


3、安装 MysqL

安装MysqL: sudo apt-get install MysqL-server MysqL-client

安装MysqL的依赖包:sudo apt-get install PHP7.0-gd PHP7.0-MysqL libMysqLclient-dev

创建数据库zabbix: MysqL -uzabbix -pniutianwen create zabbix

数据库授权:echo "grant all on zabbix.* to zabbix@localhost identified by 'niutianwen';" |MysqL -uroot -pniutianwen(此例为本地授权,如果zabbix不是安装在本地应把localhost改为安装 zabbix的那台机器的ip地址即可)

导入数据库文件到zabbix数据库

#cd /usr/local/src/zabbix-3.0.1/database

(tar xf zabbix_2.4.5.orig.tar.gz -C /usr/local/src/此例是我把zabbix的源代码包解压到 了/usr/local/src/目录下)

MysqL -D zabbix -uroot -pniutianwen < schema.sql

MysqL -D zabbix -uroot -pniutianwen < images.sql

MysqL -D zabbix -uroot -pniutianwen < data.sql


4、安装Nginx

安装Nginx: sudo apt-get install Nginx

修改配置文件

cp /etc/Nginx/sites-available/default /tmp

vim /etc/Nginx/sites-available/default

server {

listen 80 default_server;

root /usr/share/Nginx/html/zabbix;

# server_name (可定义域名访问);

index index.PHP index.html index.htm index.Nginx-debian.html;

location ~ \.PHP$ {

# include snippets/fastcgi-PHP.conf;

# With PHP7.0-cgi alone:

fastcgi_split_path_info ^(.+\.PHP)(/.+)$;

# fastcgi_pass 127.0.0.1:9000;

# With PHP7.0-fpm:

fastcgi_pass unix:/run/PHP/PHP7.0-fpm.sock;

fastcgi_index index.PHP;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

}
测试配置文件Nginx -t

重启NginxNginx -s reload

创建网站根目录: mkdir /usr/share/Nginx/html/zabbix/

将zabbix的安装PHP文件导入到网站根目录:

cd /usr/local/src/zabbix-3.0.1/frontends/

sudo cp -r PHP/* /usr/share/Nginx/html/zabbix

chmod -R zabbix zabbix /usr/share/Nginx/html/zabbix/



5、安装zabbix2.4

安装编译zabbix时所必需的依赖包:

sudo apt-get install snmp libsnmp-dev snmpd libcurl4-openssl-dev fping

获取zabbix2.4版本:

wget http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix_2.4.5.orig.tar.gz

解压包:tar xf zabbix_2.4.5.orig.tar.gz -C /usr/local/src/

编译安装zabbix2.4:

./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-MysqL --with-net- snmp --with-libcurl

make && make install


修改配置文件vim /usr/local/zabbix/etc/zabbix_server.conf

DBHost=localhost(修改数据库的IP,此例为本机)

DBName=zabbix

DBUser=zabbix

DBPassword=niutianwen

启动zabbix相关进程:

cd /usr/local/zabbix/sbin

./zabbix_server

./zabbix_agentd


ifconfig | grep inet -------->172.16.188.165(本地的IP地址)

在浏览器访问下172.16.188.165/zabbix

此处会遇到坑可以试着安装这些包后在retry:

apt-cache search bcmath

apt-get install PHP7.0-bcmath

apt-cache search mbstring

apt-get install PHP7.0-mbstring

apt-cache search PHP7.0-xml

apt-get install PHP7.0-xml

因为PHP7.0已经取消了always_populate_raw_post_data这个参数,因此要在zabbix的PHP安装文 件里修改一下代码

vim /usr/share/Nginx/html/zabbix/include/classes/setup/CFrontendSetup.PHP

// check for deprecated PHP 5.6.0 option 'always_populate_raw_post_data'

if (version_compare(PHP_VERSION,'5.6','>=') && version_compare(PHP_VERSION,'7.0.0','<')) {

$result[] = $this->checkPHPAlwaysPopulateRawPostData();


到此Zabbix就顺利的安装完成了!

原文链接:https://www.f2er.com/ubuntu/356288.html

猜你在找的Ubuntu相关文章