一、源码安装方式
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
二、yum安装方式:
1、安装Zabbix存储库:
# rpm -Uvh https://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
# yum clean all
2、安装Zabbix服务器,前端,代理:
# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
3、创建初始数据库:
# mysql -uroot -ppassword
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to [email protected] identified by ‘password‘;
4、导入初始架构和数据:
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
5、编辑文件/etc/zabbix/zabbix_server.conf
#vi 编辑文件/etc/zabbix/zabbix_server.conf
LogFile= /opt/zabbix/zabbix_server.log
DBName=zabbix
DBUser=zabbix
DBPassword=123456
6、编辑文件/etc/httpd/conf.d/zabbix.conf,取消注释并为您设置正确的时区:
date.timezone = Asia/Shanghai
7、启动Zabbix服务器和代理程序进程并使其在系统引导时启动:
# systemctl restart zabbix-server zabbix-agent httpd
8、配置Zabbix前端:
连接到新安装的Zabbix前端:http:// server_ip_or_name /
原文地址:https://www.cnblogs.com/cxq20190307/p/10755036.html