一、源码安装方式

LAMP环境准备:

\#groupadd zabbix
\#useradd -g zabbix zabbix

\#mkdir /opt/zabbix


1、安装依赖包:

\#yum install httpd php php-gd php-xml php-mysql libxml2-devel.x86\_64 net-snmp-devel.x86\_64 curl-devel

2、解压zabbix源码包到指定路径:

\#tar zvxf zabbix-3.2.3.tar.gz -C /usr/local/

\#cd /usr/local/zabbix-3.2.3/

\#./configure --prefix=/opt/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2

\#make install

3、在mysql或mariadb创建zabbix数据库及zabbix表结构导入:

mysql>create database zabbix default charset utf8;

msyql>grant all on zabbix.* to 'zabbix'@'localhost' identified by '123456'; #注:如果是用此命令授权用户导入数据,必须授权为all权限,否则导入数据时会报拒绝访问的错误

\#cd /usr/local /zabbix-3.2.3/database/mysql
\#mysql -uzabbix -p123456 zabbix < ./schema.sql
\#mysql -uzabbix -p123456 zabbix < ./imges.sql
\#mysql -uzabbix -p123456 zabbix < ./data.sql

4、查看和编辑配置文件:

\#cp /usr/local/zabbix-3.2.3/misc/init.d/fedora/core/zabbix\_server /etc/init.d/ #将server启动命令拷贝至/etc/init.d/下,服务端默认绑定端口号是10051
\#cp /usr/local/zabbix-3.2.3/misc/init.d/fedora/core/zabbix\_agentd /etc/init.d/ #将agentd启动命令拷贝至/etc/init.d/下,服务端默认绑定端口号是10050

\#vim /etc/php.ini #配置php文件
max\_execution\_time = 300
max\_input\_time = 300
post\_max\_size = 16M
date.timezone = Asia/Shanghai

\#vim /etc/init.d/zabbix\_server #配置zabbix-server编译时的路径
BASEDIR=/opt/zabbix

\#vim /etc/init.d/zabbix\_agentd #配置zabbix-agentd编译时的路径
BASEDIR=/opt/zabbix

\#vim /opt/zabbix/etc/zabbix\_server.conf #必须指定数据库名称,用户和密码
LogFile= /opt/zabbix/zabbix\_server.log
DBName=zabbix
DBUser=zabbix
DBPassword=123456
\#vim /opt/zabbix/etc/zabbix\_agentd.conf #指定zabbix-server ip地址及连接方式,主动还是被动,默认为主动方式:activeserver

5、安装Zabbix Web界面,复制PHP文件:

\#cp -r /usr/local/zabbix-3.2.3/frontends/php/ /var/www/html/zabbix

6、启动httpd服务:

\#systemctl restart httpd #注:zabbix成功安装后,无需启动zabbix-server也可得到zabbix默认页面
\#/etc/init.d/zabbix\_server start
\#/etc/init.d/zabbix\_agentd start

7、验证zabbix安装是否成功:

打开Zabbix URL:http://ip/zabbix

Zabbix源码安装与yum安装教程

标签: 安装, server, etc, yum, 源码, opt, zabbix, mysql, init

相关文章推荐

添加新评论,含*的栏目为必填