Java学习 2020-02-14
#!/bin/bash#首先关闭防火墙以及SElinuxsystemctl stop firewalldsetenforce 0#拉取官方源rpm -ivh http://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm#下载相关组件(重复执行数次以防网络问题自动断开)yum -y install zabbix-server-mysql zabbix-web-mysql mariadb mariadb-server zabbix-server zabbix-agentyum -y install zabbix-server-mysql zabbix-web-mysql mariadb mariadb-server zabbix-server zabbix-agentyum -y install zabbix-server-mysql zabbix-web-mysql mariadb mariadb-server zabbix-server zabbix-agent#启动数据库创建库并授权用户systemctl start mariadbmysql -e "create database zabbix;"mysql -e "grant all on zabbix.* to ‘tom‘@‘localhost‘ identified by ‘123‘;"mysql -e "flush privileges;"#导入初始数据cd /usr/share/doc/zabbix-server-mysql-4.4.1/ && zcat create.sql.gz | mysql -utom -p123 zabbix#修改zabbix-server配置文件sed -i ‘s/# DBPassword=/DBPassword=123/g‘ /etc/zabbix/zabbix_server.confsed -i ‘s/DBUser=zabbix/DBUser=tom/g‘ /etc/zabbix/zabbix_server.conf#修改时区sed -i ‘s/# php_value date.timezone Europe\/Riga/php_value date.timezone Asia\/Shanghai/g‘ /etc/httpd/conf.d/zabbix.conf#启动所有服务yum -y install httpdsystemctl restart zabbix-server zabbix-agent httpd
可通过本机IP/zabbix 来进行web页面的安装展示