关闭防火墙,并设置成开机不自启
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service
关闭selinux
临时关闭SELinux
[root@localhost ~]#setenforce 0
安装部署lamp
[root@python ~]# yum -y install httpd mariadb-server mariadb php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mhash
编辑配置httpd
[root@python ~]# vim /etc/httpd/conf/httpd.conf
[root@python ~]# cat /etc/httpd/conf/httpd.conf | grep ServerName
ServerName gives the name and port that the server uses to identify itself.
ServerName localhost:80
编辑配置php,配置中国时区
[root@python ~]# vim /etc/php.ini
[root@python ~]# cat /etc/php.ini | grep date.timezone
; http://php.net/date.timezone
date.timezone = PRC
启动httpd,mysql
[root@python ~]# systemctl start httpd.service
[root@python ~]# systemctl start mariadb.service
[root@python ~]# netstat -ntap | egrep ‘(80|3306)’
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 32574/mysqld
tcp6 0 0 :::80 ::? LISTEN 32295/httpd
启动msyql后执行初始安全设置。
[root@python ~]# mysql_secure_installation
[root@python ~]# mysql -uroot –p
MariaDB [(none)]> CREATE DATABASE zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> GRANT all ON zabbix.* TO ‘zabbix’@’%’ IDENTIFIED BY ‘123456’;
MariaDB [(none)]> flush privileges;
数据库设置完成,检测php与数据库连通情况
[root@python ~]# vim /var/www/html/index.php
Success!!
"; else echo "Fail!!"; mysql_close(); ?>部署Zabbix Server
[root@python ~]# yum -y install php-bcmath php-mbstring
[root@python ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/zabbix-release-3.5-1.el7.noarch.rpm
[root@python ~]# yum -y install zabbix-server-mysql zabbix-web-mysql
导入数据
把原始的数据库压缩包备份
[root@python ~]# cp /usr/share/doc/zabbix-server-mysql-4.0.0/create.sql.gz{,.bak}
[root@python ~]# cd /usr/share/doc/zabbix-server-mysql-4.0.0/
[root@python zabbix-server-mysql-4.0.0]# ls
解压数据库
[root@python zabbix-server-mysql-4.0.0]# gunzip create.sql.gz
[root@python zabbix-server-mysql-4.0.0]# ls
安装nano编辑数据库信息
[root@python zabbix-server-mysql-4.0.0]# yum -y install nano
在第一行加上USE zabbix;然后重新导入库即可
[root@python zabbix-server-mysql-4.0.0]# vim create.sql
或者用nano编辑
[root@python zabbix-server-mysql-4.0.0]# nano create.sql
[root@python zabbix-server-mysql-4.0.0]# cat create.sql | mysql -uroot –p
查看、修改zabbix配置文件
[root@python zabbix-server-mysql-4.0.0]# grep -n ‘^’[a-Z] /etc/zabbix/zabbix_server.conf
修改zabbix在httpd中的时区
[root@python ~]# vim /etc/httpd/conf.d/zabbix.conf
[root@python ~]# cat /etc/httpd/conf.d/zabbix.conf | grep “php_value date.timezone”
zabbix基本配置完成,启动服务,实现web界面安装
[root@python ~]# systemctl enable zabbix-server
[root@python ~]# systemctl start zabbix-server
[root@python ~]# systemctl restart httpd.service
web界面安装访问。
http://192.168.0.164/zabbix/