CentOS 7上安装Zabbix(快速安装监控工具Zabbix)

前提要求(optional)

安装Zabbix监控工具前,先安装必要的运行工具包

yum install gcc gcc-c++ make openssl-devel curl wget net-snmp net-snmp-utils net-snmp-libs net-snmp-devel gnutls gnutls-devel libxml2 libxml2-devel

安装httpd

yum install httpd -y
#启动apache
systemctl start httpd

浏览你的安装主机http://{httpd_ip}/

Install MariaDB

yum install -y mariadb-server mariadb 

启动MariaDB,即MySQL服务。

systemctl start mariadb

设在MySQL的root属性:

 mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we‘ll need the current
password for the root user.  If you‘ve just installed MariaDB, and
you haven‘t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y ## Enter Y and press Enter
New password:   ## Enter new password
Re-enter new password:  ## Enter password again
Password updated successfully!
Reloading privilege tables..
 ... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y  ## Enter Y and press Enter
 ... Success!
Normally, root should only be allowed to connect from ‘localhost‘.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y  ## Enter Y and press Enter
 ... Success!
By default, MariaDB comes with a database named ‘test‘ that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y  ## Enter Y and press Enter
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y  ## Enter Y and press Enter
 ... Success!
Cleaning up...
All done!  If you‘ve completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!

安装PHP

安装php命令:

#最简单方法,如果想了解php构建过程,推荐手工打包安装
yum install -y php php-mysql php-gd php-pear 

测试是否安装成功:

    vi /var/www/html/testphp.php

<?php
phpinfo();
?>

浏览php测试文件

http://{httpd_ip}/testphp.php

设置php配置属性:

post_max_size = 16M

max_execution_time = 300

max_input_time = 300

date.timezone = Asia/Shanghai

always_populate_raw_post_data = -1

具体的时区,可以参考 日期时区

安装Zabbix

#Configure the ZabbixZone package repository
rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX
rpm -Uv  http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm 

#Install the necessary server packages
yum install mysql-server zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway

设置zabbix

vi /etc/httpd/conf.d/zabbix.conf
#设置zabbix的时区
php_value date.timezone  **Asia/Shanghai**

systemctl restart httpd

创建MySQL的Zabbix数据已经导入数据库结构与数据

mysql -u root -p
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.41-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
MariaDB [(none)]> create database zabbix character set utf8;
Query OK, 1 row affected (0.05 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to ‘zabbix‘@‘localhost‘ identified by ‘password‘;
Query OK, 0 rows affected (0.21 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye

导入数据

#download zabbix source code
wget http://sourceforge.net/projects/zabbix/files/ZABBIX\ Latest\ \Stable/2.4.5/zabbix-2.4.5.tar.gz

#
tar xvf zabbix-2.4.5.tar.gz
cd zabbix-2.4.5
#导入数据
mysql -u zabbix -p zabbix < database/mysql/schema.sql
mysql -u zabbix -p zabbix < database/mysql/images.sql
mysql -u zabbix -p zabbix < database/mysql/data.sql

启动Zabbix

#If you use SELinux, run the following command to allow #Apache to communicate with Zabbix.
setsebool -P httpd_can_connect_zabbix=1

systemctl start zabbix-server
systemctl start zabbix-agent
systemctl restart httpd
systemctl restart mariadb

添加zabbix用户为Apache的www-data的系统用户组

# set the user
usermod -aG apache zabbix

cd /opt/zabbix-2.4.5
#setup the zabbix frontend php files
cp -rf frontends/php/* /var/www/html/
# restart apache
systemctl restart httpd.service

在浏览器上,设置Zabbix。

下载对应的文件或者修改对应目录下的模板文件。

登陆zabbix

NOTES: 设置系统默认启动:

systemctl enable httpd
systemctl enable mariadb
systemctl enable zabbix-server
systemctl enable zabbix-agent
时间: 2024-08-03 03:00:54

CentOS 7上安装Zabbix(快速安装监控工具Zabbix)的相关文章

在Centos 7上使用Devstack快速安装Openstack

准备环境: 1)最小安装Centos 7(6G内存+50G硬盘) 2) selinux.iptables关闭 systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 setenforce 0 # 使用豆瓣pip源 mkdir -p ~/.pip            vi ~/.pip/pip.conf [global] index-url = http://

在CentOS 7上使用Yum源安装 Zabbix 3.2

在CentOS 7上使用Yum源安装 Zabbix 3.2 1. 环境准备 [[email protected] ~]# setenforce 0 [[email protected] ~]# sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config [[email protected] ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 [[emai

(总结)CentOS 6.x使用yum快速安装Apache+PHP+Tomcat(JSP)+MySQL

(总结)CentOS 6.x使用yum快速安装Apache+PHP+Tomcat(JSP)+MySQL PS:这个是懒人yum快速安装法,用于开发和测试环境很方便,用于没有特殊要求的生产环境也可以.特殊要求的还是自己去编译安装吧~~ 1.安装Apahce.PHP.MySQL和PHP连接MySQL数据库的包:# yum -y install httpd php mysql mysql-server php-mysql 2.安装Apache常用扩展包:# yum -y install httpd-m

CentOS7.4上2分钟快速安装MySQL5.6

一.环境介绍: 腾讯云云主机全新环境安装MySQL5.6.39 [[email protected]_82_178_centos scripts]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core) 磁盘伪云盘40G 内存为2G 二.开始安装: 上传my.cnf模板文件到服务器/etc/下上传文件mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz到服务器root目录下 useradd mys

CentOS 5 上使用yum同时安装32位和64位包的解决方法

在centos上使用yum在线安装软件包的时候,有时候会同时安装32位和64位的包.并且在update的时候也会更新双份. 其实让yum只安装64位的包,只要在 /etc/yum.conf 中加个 exclude 选项: [main] cachedir=/var/cache/yum keepcache=0 plugins=1 ...... exclude=*.i?86 exclude 选项支持正则表达式,*.i?86可以用来过滤掉i386,i686等32bit包. 如果要删除已经安装的32bit

CentOS 7上源码编译安装和配置LNMP Web+phpMyAdmin服务器环境

什么是LNMP? LNMP(别名LEMP)是指由Linux, Nginx, MySQL/MariaDB, PHP/Perl/Python组合成的动态Web应用程序和服务器,它是一组Web应用程序的基础软件包,在这个基础环境上我们可以搭建任何使用PHP/Perl/Python等语言的动态网站,如商务网站.博客.论坛和开源Web应用程序软件等,它是互联网上被广泛使用的Web网站架构之一. 部署方式 从网站规模大小(访问流量.注册用户等)角度来看,LNMP架构可以使用单机部署方式和集群部署方式.单机部

zabbix快速安装

系统:Red Hat Enterprise Linux Server release 7.2 (Maipo) 环境准备: [[email protected] ~]# setenforce 0                     //临时关闭selinux setenforce: SELinux is disabled 永久关闭selinux: [[email protected] ~]# vim /etc/selinux/config 永久关闭firewalld: [[email prot

在CentOS 7上源码编译安装MySQL 5.7

1.系统环境 [[email protected]inux02 ~]# uname -r 3.10.0-514.el7.x86_64 [[email protected] ~]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) [[email protected] ~]# rpm -qa | grep mariadb mariadb-libs-5.5.52-1.el7.x86_64 [[email protected] ~

在CentOS 7上使用Yum源安装和卸载 MongoDB 3.4

1.配置Yum源 1 vim /etc/yum.repos.d/mongodb-org-3.4.repo [mongodb-org-3.4]   name=MongoDB Repository    baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/    gpgcheck=1    enabled=1    gpgkey=https://www.mongodb.org/static/pg

在CentOS 7上使用RPM包安装MySQL 5.7

shell> wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18-1.el7.x86_64.rpm-bundle.tarshell> tar xvf mysql-5.7.18-1.el7.x86_64.rpm-bundle.tarshell> sudo yum install mysql-community-{server,client,common,libs}-*    shell> vi /etc/my