1.安装依赖环境
yum -y install telnet net-tools python-paramiko dejavu-sans-fonts python-setuptools python-devel sendmail mailx net-snmp net-snmp-devel net-snm-utils freetype-devel libpng-devel perl unbound libtasnl-devel pll-kit-devel OpenIPMI unix0DBC libevent-devel mysql-devel libxml2-devel libssh2-devel OpenIPMI-devel openldap-devel curl-devel unixODBC-devel wget gcc gcc-c++
2.下载zabbix-4.0.12.tar.gz安装包
https://www.zabbix.com/
3.创建zabbix文件夹
mkdir /zabbix
4.解压源码包
tar -zxf zabbix-4.0.12.tar.gz
5.进入已解压的文件夹
cd /zabbix-4.0.12
6.配置
./configure --prefix=/home/zabbix/ --enable-server --enable-agent --enable-java --with-mysql --with-unixodbc --with-libxml2 --with-net-snmp --with-ssh2 --with-openipmi --with-ldap --with-libcurl --with-iconv --with-ssh2 --with-openipmi --with-ldap
7.编译安装
make && make install
8.查看zabbix版本和是否安装成功
/home/zabbix/sbin/zabbix_server -V
9.安装mysql数据库
yum -y install mariadb-server
10.启动数据库
systemctl start mariadb
11.进行mysql数据库初始化
mysql_secure_installation
12.进入数据库,创建zabbix数据库
create database zabbix character set utf8 collate utf8_bin;
13.创建zabbix访问数据库的用户
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix@lfl123';
14.导入zabbix表结构
mysql -uzabbix -pzabbix@lfl123 zabbix</root/zabbix-4.0.12/database/mysql/schema.sql mysql -uzabbix -pzabbix@lfl123 zabbix</root/zabbix-4.0.12/database/mysql/images.sql mysql -uzabbix -pzabbix@lfl123 zabbix</root/zabbix-4.0.12/database/mysql/data.sql
vim /zabbix/etc/zabbix_server.conf
groupadd --system zabbix useradd --system -g zabbix -s /sbin/nologin -c "Zabbix" zabbix
/home/zabbix/sbin/zabbix_server -c /zabbix/etc/zabbix_server.conf
vim/zabbix/etc/zabbix_agentd.conf
/home/zabbix/sbin/zabbix_agentd -c /zabbix/etc/zabbix_agentd.conf
rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
yum -y install zabbix-web-mysql
cat /etc/php.ini max_execution_time = 300 max_input_time = 300 max_input_vars = 10000 memory_limit = 128M post_max_size = 16M always_populate_raw_post_data = -1 date.timezone ="Asia/Shanghai"
23.启动httpd服务
systemctl start httpd
systemctl enable httpd
25.访问
ip:port/zabbix
26.zabbix服务端安装客户端启动并加入开机自启动
yum -y install zabbix_agent
systemctl start zabbix_agent
systemctl enable zabbix_agent
27. 被监控端安装zabbix_agent客户端
rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm yum -y install zabbix_agent systemctl start zabbix_agent systemctl enable zabbix_agent