hb_sz 发表于 2019-1-24 13:21:21

centos7.x之yum安装zabbix

  1、安装LAMP
#关闭防火墙方便测试
yum install epel-release -y
systemctl stop firewalld.service
systemctl disable firewalld.service
setenforce 0#安装httpd
yum install httpd
systemctl start httpd.service
systemctl enable httpd.service#安装数据库5.6
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
systemctl restart mysqld.service
#设置msyql密码为 123456
mysql> set password for 'root'@'localhost' =password('123456');
#远程连接设置,所有以root账号连接的远程用户,设其密码为 123456
mysql> grant all on xxxx.* to 'root'@'%' identified by '123456' with grant option;
#更新权限
mysql>flush privileges;
#数据库开机启动
systemctl enable mysqld.service#安装php
yum install php -y
#安装PHP组件,使PHP支持mysql
yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash -y
#重启对应服务
systemctl restart mysqld.service
systemctl restart httpd.service
#以上 安装 apahce 、mysql 、php安装完毕。
查看安装环境版本:
cd/var/www/html,新建index.php文件,输入:
  2、安装zabbix
#安装zabbix server
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
#安装Zabbix server and agent(agent是可选的)
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway -y
vi /etc/httpd/conf.d/zabbix.conf
更新时区:
php_value date.timezone Asia/Shanghai
#重启httpd
systemctl restart httpd#创建MySQL 数据库和用户
mysql –u root –p
mysql> create database zabbix character set utf8;
mysql> grant all privileges on zabbix.* to 'zabbix'@'%' identified by 'zabbix';
mysql> flush privileges;#数据库导入zabbix template
#-p 后面的zabbix不是密码,而是选择zabbix数据库,导入都是数据表
zcat /usr/share/doc/zabbix-server-mysql-3.4.0/create.sql.gz | mysql -uzabbix -p zabbix
#Configure database for Zabbix server/proxy
# vi /etc/zabbix/zabbix_server.conf
DBHost=192.168.1.100
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix#Starting Zabbix server process
systemctl start zabbix-server
systemctl enable zabbix-server
#添加selinux设置
setsebool -P httpd_can_connect_zabbix on
setsebool -P httpd_can_network_connect_db on
systemctl start httpd#修改PHP 设置,后来再搭建多几次发现这个php设置可以不用更改
vi /etc/php.ini
max_execution_time = 600
max_input_time = 600
memory_limit = 256
Mpost_max_size = 32M
upload_max_filesize = 16M
date.timezone = Asia/Shanghai#允许Zabbix web console 对特定IP段可用 (可选)
vi /etc/httpd/conf.d/zabbix.conf
如果设置 ‘Allow from All’, 这可以允许全部可以访问
      php_value upload_max_filesize 2M
      php_value max_input_time 300
      php_value always_populate_raw_post_data -1
      # php_value date.timezone Europe/Riga
      php_value date.timezone Asia/Shanghai
   


    Require all denied


    Require all denied


    Require all denied


    Require all denied
#前端web界面访问配置
http://192.168.1.100/zabbix/setup.php
#zabbix默认账号和密码
The default user name is Admin, password zabbix.#添加zabbix-agent,前面安装zabbix server的时候,一起yum安装了,现在只要修改一下数据即可
vim /etc/hosts
添加
192.168.1.100   Zabbix server
service zabbix-agent start
chkconfig zabbix-agent onhttps://s2.运维网.com/wyfs02/M01/03/E6/wKiom1mi7NOwZMkCAACA-C0WRsw867.png-wh_500x0-wm_3-wmp_4-s_658741008.pnghttps://s4.运维网.com/wyfs02/M02/A2/97/wKioL1mi7LyDKeMUAABjCifleKI576.png-wh_500x0-wm_3-wmp_4-s_916496860.pnghttps://s1.运维网.com/wyfs02/M02/03/E6/wKiom1mi7LSB7_ZxAABTpYoJcXo765.png-wh_500x0-wm_3-wmp_4-s_2269190362.png
https://s1.运维网.com/wyfs02/M02/A2/97/wKioL1mi7KnzKmpSAAByS9KrRYY731.png-wh_500x0-wm_3-wmp_4-s_2569219284.png
https://s4.运维网.com/wyfs02/M00/03/E6/wKiom1mi7LbDrLQXAABO1spCnso972.png-wh_500x0-wm_3-wmp_4-s_52801634.pnghttps://s2.运维网.com/wyfs02/M00/03/E6/wKiom1mi7MnyPb-kAAG6BjqvHaA534.png-wh_500x0-wm_3-wmp_4-s_527994511.png
  

  




页: [1]
查看完整版本: centos7.x之yum安装zabbix