企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# centos7安装zabbix3.0步骤与总结 **搭建环境:** centos 7 **依赖工具:** lamp,zabbix **安装前准备:** 安装依赖环境,关闭防火墙,关闭SELINUX。 1. 关闭防火墙: 1. 说明:CentOS 默认集成并开启了firewall防火墙,需要将其关闭或者放行端口,否则服务将不能正常的使用 1. 关闭防火墙 ``` systemctl stop firewalld.service ``` 2. 查看/放行端口 重启命令 ``` firewall-cmd --zone=public --list-ports firewall-cmd --zone=public --add-port=80/tcp --permanent firewall-cmd --reload ``` 2. 关闭SELINUX 1. 修改selinux ``` vim /etc/selinux/config ``` 2. 立即生效 ``` setenforce 0 ``` **1. 安装必要的依赖:** ``` yum -y install wget net-snmp-devel OpenIPMI-devel httpd openssl-devel java lrzsz fping-devel libcurl-devel perl-DBI pcre-devel libxml2 libxml2-devel mysql-devel gcc php php-bcmath php-gd php-xml php-mbstring php-ldap php-mysql.x86_64 php-pear php-xmlrpc net-tools vim-enhanced ``` **2. 安装LAMP环境(Linux+Apache+MariaDB+PHP):** 1. 安装环境 ``` yum -y install mariadb mariadb-server php php-mysql httpd ``` 2. 设置MariaDB开机自启动 ``` systemctl start mariadb.service systemctl enable mariadb.service ``` 3. 配置MariaDB ``` mysql_secure_installation ``` 4. 创建zabbix所需的数据库 ``` CREATE DATABASE zabbix default character set utf8 collate utf8_bin; ``` 5. 创建数据库用户 ``` CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'zabbix'; ``` 6. 权限给予 ``` grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; ``` 7. 刷新数据库 ``` flush privileges; ``` 8. 链接数据库测试 ``` mysql -uzabbix -pzabbix; ``` 9. Apache设置 ``` #启动Apache服务 systemctl start httpd.service #开机自启动 systemctl enable httpd.service #端口监控 netstat -ltun ``` **3. 安装ZABBIX**: 1. 安装ZABBIX的YUM源 ``` rpm -i http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm ``` 2. 安装zabbix服务 ``` yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-get ``` 3. 导入zabbix数据库结构 ``` cd /usr/share/doc/zabbix-server-mysql-xxx zcat create.sql.gz | mysql -uzabbix -pzabbix zabbix ``` 4. 修改zabbix sever的配置文件 ``` vim /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix ``` 5. 修改下zabbix.conf文件 ``` vim /etc/httpd/conf.d/zabbix.conf #开启 时区设置 php_value date.timezone Asia/Shanghai ``` 6. 启动zabbix-server并加入开机启动 ``` systemctl start zabbix-server.service systemctl enable zabbix-server.service ``` 7. 重启apache ``` systemctl restart httpd.service ``` **4. 配置zabbix** > 安装配置:http://ip/zabbix/setup.php 输入数据库信息,之后进入登录界面。默认用户名是**Admin** 密码 **zabbix** **5. 安装zabbix agent**: ``` yum clean all yum -y install zabbix zabbix-agent ``` 1. 配置zabbix agen ``` vim /etc/zabbix/zabbix_agentd.conf PidFile=/var/run/zabbix/zabbix_agentd.pid LogFile=/var/log/zabbix/zabbix_agentd.log LogFileSize=0 Server=127.0.0.1 ServerActive=127.0.0.1 Hostname=127.0.0.1 Include=/etc/zabbix/zabbix_agentd.d/ ``` 2. 启动客户端 ``` zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf systemctl start zabbix-agent systemctl restart zabbix-agent systemctl enable zabbix-agent ``` 3. 设置中文:点击个人-》语言设置