zabbix 3.0快速安装简介(centos 6)

时间:2022-06-23 00:40:07

zabbix快速安装

系统版本:centos 6

1、yum源配置和zabbix、msyql安装

rpm -ivh http://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
yum install httpd zabbix zabbix-server zabbix-web zabbix-server-mysql zabbix-web-mysql mysql-server -y

2、php安装

rpm -ivh http://mirror.webtatic.com/yum/el6/latest.rpm
yum install php55w php55w-mysql php55w-common php55w-gd php55w-mbstring php55w-mcrypt php55w-devel php55w-xml php55w-bcmath php55w-fpm -y
cp -R /usr/share/zabbix/ /var/www/html/

3、mysql配置

cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
启动MySQL
/etc/init.d/mysqld start
创建用户并授权
mysql
create database zabbix character set utf8 collate utf8_bin;
grant all on zabbix.* to zabbix@'localhost' identified by '123456';
flush privileges;
exit

4、导入zabbix数据文件

cd /usr/share/doc/zabbix-server-mysql-3.0.5
zcat create.sql.gz |mysql -uzabbix -p123456 zabbix

5、php配置

修改php配置文件
vim /etc/php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/shanghai

6、zabbix server配置

vim /etc/zabbix/zabbix_server.conf
修改数据库地址、数据库名、 用户、密码
分别对应
DBHost=
DBName=
DBUser=
DBPassword=
DBSocket=/var/lib/mysql/mysql.sock

7、nginx配置

/usr/local/nginx/conf下创建extra目录

/usr/local/nginx/conf/extra创建zabbix.conf

server {
listen 80;
server_name localhost;
root /var/www/html;
index index.php index.html index.htm;
access_log logs/zabbix_access.log;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.(php|php5)?$ {
root /var/www/html/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
include fastcgi_params;
}
}

在nginx.conf文件中的http下加入

include  extra/zabbix.conf;

8、重启

nginx重启

/etc/init.d/php-fpm start

/etc/init.d/zabbix-server start