zabbix源码安装

  1. 安装mariadb(mysql)
// 执行安装命令
# yum -y install mariadb mariadb-server mariadb-devel

// 启动服务
# systemctl start mariadb

// 设置为开机启动
# systemctl enable mariadb

// 修改root登录密码
# mysql_secure_installation
Enter current password for root (enter for none): [回车]
Set root password? [Y/n] y
New password: 
Re-enter new password: 
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

// 测试登陆
# mysql -uroot -ppassword

// 设置root访问权限
# mysql -uroot -ppassword
MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' identified by 'qwe123' with grant option;
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;
  1. 安装依赖库
// 以下二选一
// 最小
# yum -y install gcc net-snmp-devel libxml2-devel libcurl-devel  libevent libevent-devel
// 完全
# yum -y install gcc net-snmp-devel net-snmp net-snmp-utils libxml2 libxml2-devel libcurl libcurl-devel libevent libevent-devel
  1. 下载源码,并配置安装
    下载地址:
    https://www.zabbix.com/download
    https://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.4/zabbix-3.4.4.tar.gz
    上传zabbix-3.4.4.tar.gz到/home目录下
# cd /home
# tar -zxf zabbix-3.4.4.tar.gz
# cd zabbix-3.4.4
# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-java --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
# make && make install
  1. 初始化数据
# mysql -uroot -ppassword
MariaDB [none]> create database if not exists zabbix default character set utf8 collate utf8_general_ci;
MariaDB [none]> use zabbix;
MariaDB [zabbix]> source /home/zabbix-3.4.4/database/mysql/schema.sql;
MariaDB [zabbix]> source /home/zabbix-3.4.4/database/mysql/images.sql;
MariaDB [zabbix]> source /home/zabbix-3.4.4/database/mysql/data.sql;
  1. 安装fping
    zabbix 3之后把ping更换为fping了,所以需要安装fping
# wget http://www.fping.org/dist/fping-4.0.tar.gz
# tar -zxvf fping-4.0.tar.gz
# cd fping-4.0
# ./configure --prefix=/usr/local/fping
# make && make install
  1. 配置
// server配置
# cd /usr/local/zabbix/
# vi ./etc/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=root
DBPassword=password
AllowRoot=1
FpingLocation=/usr/local/fping/sbin/fping

// agent配置
# vi ./etc/zabbix_agentd.conf
Server=0.0.0.0/0
Hostname=Zabbix server #注释掉
AllowRoot=1
  1. 启动服务
# /usr/local/zabbix/sbin/zabbix_server
# /usr/local/zabbix/sbin/zabbix_agent
  1. 配置前端环境
// 安装apache+php
# yum -y install httpd httpd-devel php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml php-bcmath

// 复制前端代码到站点下
# cp -r /home/zabbix-3.4.4/frontends/php /var/www/html/zabbix

// 关闭防火墙
# systemctl stop firewalld
# setenforce 0
# vi /etc/selinux/config
SELINUX=disabled

// 修改php配置
# vi /etc/php.ini
memory_limit=128M
post_max_size=16M
upload_max_filesize=20M
max_execution_time=300
max_input_time=300
date.timezone=Asia/Shanghai

// 重启站点
# systemctl restart httpd

访问站点按提示进行配置即可
http://localhost/zabbix

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容