一、关闭防火墙和SELinux

[root@VM_0_16_centos ~]# systemctl stop firewalld
[root@VM_0_16_centos ~]# systemctl disable firewalld
[root@VM_0_16_centos ~]# setenforce 0
[root@VM_0_16_centos ~]# sed -i “s/SELINUX=enforcing/SELINUX=disabled/g” /etc/selinux/config

二、安装部署LAMP环境

[root@VM_0_16_centos ~]# yum install -y httpd php php-mysql mariadb mariadb-server
[root@VM_0_16_centos ~]# systemctl start httpd mariadb
[root@VM_0_16_centos ~]# systemctl enable httpd mariadb
[root@VM_0_16_centos ~]# mysql_secure_installation
Enter current password for root (enter for none):    #输入root密码。未设置,直接回车。
Set root password? [Y/n] y                           #是否现在设置root密码?
New password:                                        #输入root密码   
Re-enter new password:                               #再次输入一遍root密码
Remove anonymous users? [Y/n] y                      #是否移除匿名用户?
Disallow root login remotely? [Y/n] y                #是否禁止root远程登录?
Remove test database and access to it? [Y/n] y       #是否现在移除测试数据库和数据?
Reload privilege tables now? [Y/n] y                 #是否现在重载特权表?
[root@VM_0_16_centos ~]# rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
[root@VM_0_16_centos ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
[root@VM_0_16_centos ~]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent

  ★如果zabbix源访问异常,请尝试一下方法:

[root@VM_0_16_centos ~]# yum -y install lrzsz
[root@VM_0_16_centos ~]# rz
[root@VM_0_16_centos ~]# tar -xzf zabbix-4.0-rpms.tar.gz
[root@VM_0_16_centos yum.repos.d]# mv zabbix.repo zabbix.repo.bak
[root@VM_0_16_centos yum.repos.d]# vim zabbix-install.repo    (写入一下内容)
[zabbix4.0]
name="zabbix4.0-install-rpms"
baseurl=file:///root/zabbix-4.0-rpms
enabled=1
gpgcheck=0
[root@VM_0_16_centos ~]# yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent
[root@VM_0_16_centos ~]# mysql -u root -p
MariaDB [(none)]> CREATE DATABASE zabbix DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
[root@VM_0_16_centos ~]# cd /usr/share/doc/zabbix-server-mysql-4.0.10/
[root@VM_0_16_centos zabbix-server-mysql-4.0.10]# zcat create.sql.gz | mysql -uroot -p zabbix
[root@VM_0_16_centos zabbix-server-mysql-4.0.10]# mysql -u root -p
MariaDB [(none)]> use zabbix
MariaDB [zabbix]> SHOW TABLES;

    如下图:

zabbix安装需要多大内存_zabbix

三、启动Zabbix服务

[root@VM_0_16_centos ~]# vim /etc/zabbix/zabbix_server.conf         #仅需修改以下列出部分
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

    如下图:

zabbix安装需要多大内存_zabbix_02

[root@VM_0_16_centos ~]# systemctl start zabbix-server.service 
[root@VM_0_16_centos ~]# systemctl enable zabbix-server.service
[root@VM_0_16_centos ~]# vim /etc/httpd/conf.d/zabbix.conf
        php_value max_execution_time `300`
        php_value memory_limit `128M`
        php_value post_max_size `16M`
        php_value upload_max_filesize `2M`
        php_value max_input_time `300`
        php_value max_input_vars `10000`
        php_value always_populate_raw_post_data `-1`
        php_value date.timezone `Asia/Shanghai`

    如下图:

zabbix安装需要多大内存_zabbix_03


    否则安装 zabbix web时会报以下错误

zabbix安装需要多大内存_server_04

[root@VM_0_16_centos ~]# systemctl restart httpd
[root@VM_0_16_centos ~]# ntpdate ntp.sjtu.edu.cn        #或者使用cn.pool.ntp.org这个时间同步服务器
3 Jul 18:53:36 ntpdate[5330]: the NTP socket is in use, exiting

    注意:生产中往往自行搭建内网时间同步服务器,通过定时任务定期同步时间,从而保证和实现各集群主机的时间一致性

四、安装Zabbix Web

    1、浏览器访问你的Zabbix服务器IP(http://IP地址/zabbix),然后点击“Next step

zabbix安装需要多大内存_zabbix_05


    扩展:修改Apache网站跟目录为Zabbix网页目录(/usr/share/zabbix),实现直接输入IP地址就能访问

zabbix安装需要多大内存_zabbix安装需要多大内存_06

[root@VM_0_16_centos ~]# vim /etc/httpd/conf/httpd.conf

zabbix安装需要多大内存_server_07

[root@VM_0_16_centos ~]# systemctl restar httpd  #网页直接访问IP地址即可,省去了IP地址后再输入`/zabbix`的麻烦。

    2、安装程序检查相关环境,没有问题的话,点击“下一步”(我这里的中文是Google浏览器自动翻译的)

zabbix安装需要多大内存_监控_08

zabbix安装需要多大内存_server_09

    4、设置服务器端的相关信息(默认即可

zabbix安装需要多大内存_监控_10

    5、安装前对设置参数的概览,直接点击“下一步

zabbix安装需要多大内存_zabbix安装需要多大内存_11

    6、安装成功,点击“Finish

zabbix安装需要多大内存_zabbix安装需要多大内存_12

zabbix安装需要多大内存_zabbix_13


            默认用户名:Admin

            默认密码:zabbix

五、Zabbix相关配置

  ①依次点击:Administration >>> Users >>> Admin

zabbix安装需要多大内存_zabbix_14

  ②点击“Language”选择“Chinese(zh_CN)”>>> 点击“Update”>>>然后“刷新页面”即可

zabbix安装需要多大内存_server_15


zabbix安装需要多大内存_zabbix_16

  ①修改配置文件:/etc/zabbix/zabbix_agentd.conf(修改一下三项内容)
[root@VM_0_16_centos ~]# vim /etc/zabbix/zabbix_agentd.conf    
Server=152.16.19.63                 #指定zabbix服务器地址
ServerActive=152.16.19.63           #指定zabbix服务器地址
Hostname=152.16.19.63               #被监控主机的主机名或IP地址

zabbix安装需要多大内存_zabbix安装需要多大内存_17

[root@VM_0_16_centos ~]# systemctl restart zabbix-agent.service
[root@VM_0_16_centos ~]# systemctl enable zabbix-agent.service 
[root@VM_0_16_centos ~]# netstat -luntap | grep zabbix

zabbix安装需要多大内存_集群_18