cat /etc/redhat-release #查看系统版本信息
systemctl stop firewalld.service #关闭防火墙
systemctl disable firewalld.service #开机禁止启动防火墙
yum install -y httpd mariadb-server mariadb php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mhash #安装环境
rpm -qa httpd php mariadb #安装后检查应用版本
vim /etc/httpd/conf/httpd.conf
ServerName www.aihuidi.com:80 #修改主机名
DirectoryIndex index.html index.ph #修改首页文件格式
date.timezone = PRC
systemctl start mariadb #启动数据库
systemctl enable mariadb #加入开机自启动
systemctl status mariadb #查看运行状态
netstat -lntup | grep mysqld #查看服务
mysqladmin -u root passowrd aihuidi #设置数据库密码
mysql -Uroot -p #登录数据库
CREATE DATABASE zabbix character set utf8 collate utf8_bin; #创建zabbix数据库
GRANT all ON zabbix.* TO 'zabbix'@'%' IDENTIFIED BY 'zabbix';
flush privileges; #刷新权限
select user,host from mysql.user; #查看用户
drop user ''@localhost; #删除空用户
yum -y install net-snmp net-snmp-devel curl curl-devel libxml2 libxml2-devel libevent-devel.x86_64 javacc.noarch javacc-javadoc.noarch javacc-maven-plugin.noarch javacc*
yum install php-bcmath php-mbstring -y #安装php支持zabbix组件
rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm 安装zabbix yum源
yum install zabbix-server-mysql zabbix-web-mysql -y 安装zabbix组件
zcat /usr/share/doc/zabbix-server-mysql-4.0.9/create.sql.gz | mysql -uzabbix -p -h 192.168.200.157 zabbix #导入数据库信息 主机之间zabbix的版本和数据库的版本
vim /etc/zabbix/zabbix_server.conf38:LogFile=/var/log/zabbix/zabbix_server.log49:LogFileSize=072:PidFile=/var/run/zabbix/zabbix_server.pid82:SocketDir=/var/run/zabbix100:DBName=zabbix116:DBUser=zabbix124:DBPassword=zabbix 把注释打开写zabbix库的密码356:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log473:Timeout=4516:AlertScriptsPath=/usr/lib/zabbix/alertscripts527:ExternalScripts=/usr/lib/zabbix/externalscripts563:LogSlowQueries=3000
vim /etc/httd.conf.d/zabbix.confphp_value date.timezone Asia/Shanghai
systemctl enable zabbix-server #启动zabbix服务并添加入开机自启动systemctl start zabbix-serversystemctl start httpd #启动httd服务并添加入开机自启动systemctl enable httpd
用户Admin
密码zabbix
安装zabbix-agent客户端
yum install zabbix-agent -y systemctl start zabbix-agent.service systemctl enable zabbix-agent.service
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpmyum -y install zabbix-agent
vim /etc/zabbix/zabbix_agentd.confServer=主服务器IP地址
systemctl start zabbix-agent.servicesystemctl enable zabbix-agent.service