├── README.md └── 第三章 ZabbixServer安装 ├── 3.1 Zabbix二进制包安装-命令列表 └── 3.2 Zabbix源码包安装-命令列表 /README.md: -------------------------------------------------------------------------------- 1 | # zabbix 2 | Zabbix 4.0企业实战课程资料 3 | -------------------------------------------------------------------------------- /第三章 ZabbixServer安装/3.1 Zabbix二进制包安装-命令列表: -------------------------------------------------------------------------------- 1 | centos 7 添加阿里云镜像 2 | wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 3 | yum install epel-release 4 | 5 | 6 | 安装常用的开发组件 7 | yum groups install "Development Tools" 8 | yum groups info "Development Tools" 9 | 10 | 11 | 增加Zabbix镜像源 12 | rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm 13 | 14 | 15 | 关闭SElinux 16 | systemctl stop firewalld.service 17 | systemctl disable firewalld.service 18 | 19 | vim /etc/selinux/config 20 | 21 | yum install iptables-services 22 | 23 | 24 | 安装Zabbix Server和Frontend 25 | yum install zabbix-server-mysql 26 | yum install zabbix-web-mysql 27 | 28 | 29 | 安装MySQL 30 | yum install mariadb-server 31 | systemctl start mariadb.service 32 | systemctl status mariadb.service 33 | mysql_secure_installation 34 | 35 | 36 | 创建数据库 37 | mysql -uroot -p 38 | create database zabbix character set utf8 collate utf8_bin; 39 | grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix@findsec123'; 40 | 41 | 导入数据结构 42 | zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix@findsec123 zabbix 43 | 44 | 45 | 配置Zabbix Serve 46 | vim /etc/zabbix/zabbix_server.conf 47 | 48 | 49 | 启动Zabbix Server 50 | systemctl start zabbix-server.service 51 | systemctl status zabbix-server.service 52 | 53 | more /var/log/zabbix/zabbix_server.log 54 | 55 | 56 | 配置Zabbix frontend 57 | vim /etc/php.ini 58 | 59 | max_execution_time = 300 60 | memory_limit = 128M 61 | post_max_size = 16M 62 | upload_max_filesize = 2M 63 | max_input_time = 300 64 | max_input_vars = 10000 65 | always_populate_raw_post_data = -1 66 | date.timezone = Asia/Shanghai 67 | 68 | 69 | 启动httpd 70 | systemctl start httpd.service 71 | systemctl status httpd.service 72 | 73 | http://10.211.55.7/zabbix/setup.php 74 | 75 | Admin 76 | zabbix 77 | 78 | 79 | 安装Zabbix Agent 80 | yum install zabbix-agent 81 | 82 | systemctl start zabbix-agent.service 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /第三章 ZabbixServer安装/3.2 Zabbix源码包安装-命令列表: -------------------------------------------------------------------------------- 1 | 下载zabbix server源码包 2 | wget -O zabbix-4.0.4.tar.gz https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.0.4/zabbix-4.0.4.tar.gz/download 3 | 4 | 安装依赖 5 | yum install wget telnet net-tools python-paramiko gcc gcc-c++ dejavu-sans-fonts python-setuptools python-devel sendmail mailx net-snmp net-snmp-devel net-snmp-utils freetype-devel libpng-devel perl unbound libtasn1-devel p11-kit-devel OpenIPMI unixODBC libevent-devel mysql-devel libxml2-devel libssh2-devel OpenIPMI-devel java-1.8.0-openjdk-devel openldap-devel curl-devel unixODBC-devel 6 | 7 | 解压并编译安装 8 | tar -zxvf zabbix-4.0.4.tar.gz 9 | cd zabbix-4.0.4/ 10 | 11 | 建立编译安装目录 12 | mkdir -p /data/findsec/zabbix 13 | ./configure --prefix=/data/findsec/zabbix --enable-server --enable-agent --enable-java --with-mysql --with-libxml2 --with-unixodbc --with-net-snmp --with-ssh2 --with-openipmi --with-ldap --with-libcurl --with-iconv 14 | make 15 | make install 16 | 17 | 18 | /data/findsec/zabbix/sbin/zabbix_server -V 19 | 20 | 21 | 数据库安装 22 | yum install mariadb-server 23 | systemctl start mariadb.service 24 | systemctl status mariadb.service 25 | mysql_secure_installation 26 | 27 | 创建数据库 28 | mysql -uroot -p 29 | create database zabbix character set utf8 collate utf8_bin; 30 | grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix@findsec123'; 31 | 32 | 导入数据结构 33 | mysql -uzabbix -pzabbix@findsec123 zabbix < /root/zabbix-4.0.4/database/mysql/schema.sql 34 | mysql -uzabbix -pzabbix@findsec123 zabbix < /root/zabbix-4.0.4/database/mysql/images.sql 35 | mysql -uzabbix -pzabbix@findsec123 zabbix < /root/zabbix-4.0.4/database/mysql/data.sql 36 | 37 | 修改zabbix server配置 38 | vim /data/findsec/zabbix/etc/zabbix_server.conf 39 | 40 | 增加用户 41 | groupadd --system zabbix 42 | useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix 43 | 44 | 启动服务 45 | /data/findsec/zabbix/sbin/zabbix_server -c /data/findsec/zabbix/etc/zabbix_server.conf 46 | 47 | tailf /tmp/zabbix_server.log 48 | 49 | 50 | 增加Zabbix镜像源 51 | rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm 52 | 53 | 安装Zabbix Frontend 54 | yum install zabbix-web-mysql 55 | 56 | 配置Zabbix frontend 57 | vim /etc/php.ini 58 | 59 | max_execution_time = 300 60 | memory_limit = 128M 61 | post_max_size = 16M 62 | upload_max_filesize = 2M 63 | max_input_time = 300 64 | max_input_vars = 10000 65 | always_populate_raw_post_data = -1 66 | date.timezone = Asia/Shanghai 67 | 68 | 69 | 启动httpd 70 | systemctl start httpd.service 71 | systemctl status httpd.service 72 | 73 | http://10.211.55.7/zabbix/setup.php 74 | 75 | Admin 76 | zabbix 77 | 78 | 79 | 安装Zabbix Agent 80 | yum install zabbix-agent 81 | 82 | systemctl start zabbix-agent.service 83 | --------------------------------------------------------------------------------