Zabbix源码安装部署

zabbix源码部署安装

参考文档:https://www.zabbix.com/documentation/4.0/manual/installation/install

​ https://www.zabbix.com/documentation/4.0/manual/appendix/install/db_scripts

这里以zabbix-4.0.1为例,环境为CentOS 7

源码包下载地址:https://www.zabbix.com/download_sources

源码包下载

cd /usr/local/src/
wget https://superb-dca2.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.0.1/zabbix-4.0.1.tar.gz
tar xf zabbix-4.0.1.tar.gz

创建zabbix用户

groupadd zabbix

useradd -g zabbix zabbix

数据库操作

安装zabbix server之前,需要先准备数据库,这里以Mysql数据库为例进行安装,其它数据库请参考https://www.zabbix.com/documentation/4.0/manual/appendix/install/db_scripts

mysql -uroot -p<password>

mysql> create database zabbix character set utf8 collate utf8_bin;

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';

mysql> quit;

cd /usr/local/src/zabbix-4.0.1/database/mysql

mysql -uzabbix -p<password> zabbix < schema.sql

# 如果是安装zabbix-proxy,不需要导入下面的数据
mysql -uzabbix -p<password> zabbix < images.sql
mysql -uzabbix -p<password> zabbix < data.sql

安装

Server端

yum -y install libevent-devel libxml2-devel curl-devel net-snmp-devel mysql-devel libssh2-devel
#自Zabbix 3.0.0起,支持SMTP认证需要具有cURL 7.20.0或更高版本的--with-libcurl配置选项。 自Zabbix 2.2.0起支持虚拟机监视需要--with-libcurl和--with-libxml2配置选项
cd /usr/local/src/zabbix-4.0.1
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-ssh2 --with-net-snmp --with-libcurl --with-libxml2 
make install

Agent端

cd /usr/local/src
tar xf  zabbix-4.0.1.tar.gz
./configure --prefix=/usr/local/zabbix_agent --enable-agent
make install 

修改配置文件

#server配置文件
egrep -v "^#|^$" /usr/local/zabbix/etc/zabbix_server.conf

LogFile=/tmp/zabbix_server.log
PidFile=/tmp/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=your_password   #修改密码
DBSocket=/var/lib/mysql/mysql.sock
DBPort=3306
Timeout=4
LogSlowQueries=3000

#agent配置文件
egrep -v "^#|^$" /usr/local/zabbix/etc/zabbix_agentd.conf  
LogFile=/tmp/zabbix_agentd.log
Server=127.0.0.1        
ServerActive=127.0.0.1      #主动通知
Hostname=Zabbix server #各个agent不能相同

启动

/usr/local/zabbix/sbin/zabbix_server
/usr/local/zabbix/sbin/zabbix_agentd 

Web配置

安装Nginx和PHP(此处我是使用yum安装的PHP,php-fpm)

yum -y install php-bcmath php-gd  php-xmlwriter php-mbstring  php-mysql

systemctl restart php-fpm

PHP需要配置

Pre-requisiteMinimum valueDescription
PHP version5.4.0
PHP memory_limit option128MBIn php.ini: memory_limit = 128M
PHP post_max_size option16MBIn php.ini: post_max_size = 16M
PHP upload_max_filesize option2MBIn php.ini: upload_max_filesize = 2M
PHP max_execution_time option300 seconds (values 0 and -1 are allowed)In php.ini: max_execution_time = 300
PHP max_input_time option300 seconds (values 0 and -1 are allowed)In php.ini: max_input_time = 300
PHP session.auto_start optionmust be disabledIn php.ini: session.auto_start = 0
Database supportOne of: MySQL, Oracle, PostgreSQL, IBM DB2One of the following modules must be installed: mysql, oci8, pgsql, ibm_db2
bcmathphp-bcmath
mbstringphp-mbstring
PHP mbstring.func_overload optionmust be disabledIn php.ini: mbstring.func_overload = 0
PHP always_populate_raw_post_data optionmust be disabledRequired only for PHP versions 5.6.0 or newer. In php.ini: always_populate_raw_post_data = -1
socketsphp-net-socket. Required for user script support.
gd2.0 or higherphp-gd. PHP GD extension must support PNG images (--with-png-dir), JPEG (--with-jpeg-dir) images and FreeType 2 (--with-freetype-dir).
libxml2.6.15php-xml or php5-dom
xmlwriterphp-xmlwriter
xmlreaderphp-xmlreader
ctypephp-ctype
sessionphp-session
gettextphp-gettext Since Zabbix 2.2.1, the PHP gettext extension is not a mandatory requirement for installing Zabbix. If gettext is not installed, the frontend will work as usual, however, the translations will not be available.

转载于:https://www.cnblogs.com/Template/p/9936036.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值