首页 > 代码库 > zabbix搭建
zabbix搭建
1、添加zabbix用户
groupadd zabbix -g 201
useradd -g zabbix -u 201 -m zabbix
yum install net-snmp-devel curl curl-devel mysql-devel php-bcmath
3、解压
tar zxvf zabbix-3.0.7.tar.gz
4、拷贝到/usr/local/zabbix
mv /usr/local/src/zabbix-3.0.7 /usr/local/zabbix
5、编译
cd /usr/local/zabbix/
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-net-snmp --with-libcurl --enable-proxy --with-mysql=/usr/local/mysql/bin/mysql_config
期间会报很多错,yum相关的包就可以了
6、make;make install
7、zabbix 数据库
进入mysql
mysql> create database zabbix character set utf8;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix‘;
mysql> flush privileges;
导入数据库
cd /usr/local/zabbix/database/mysql/
mysql -uzabbix -pzabbix zabbix < schema.sql
mysql -uzabbix -pzabbix zabbix < images.sql
mysql -uzabbix -pzabbix zabbix < data.sql
8、拷贝脚本
cd /usr/local/zabbix/misc/init.d/fedora/core
cp zabbix_server /etc/init.d/
cp zabbix_agentd /etc/init.d
chmod 755 /etc/init.d/zabbix_*
9、vi /etc/init.d/zabbix_server
修改zabbix的安装目录 BASEDIR=/usr/local/zabbix
vi /etc/init.d/zabbix_agentd
修改zabbix的安装目录 BASEDIR=/usr/local/zabbix
10、修改zabbix_server.conf
vi /usr/local/zabbix/etc/zabbix_server.conf
DBUser=zabbix
DBPassword=zabbix
AllowRoot=1
DBSocket=/tmp/mysql.sock (ps aux|grep mysqld 可知)
11、把zabbix文件拷贝到ngixn目录下
cd /usr/local/zabbix
mkdir -p /data/web/zabbixServer/
cp -r frontends/php/* /data/web/zabbixServer/
mkdir -p /usr/local/nginx/conf/vhosts
修改 vi /usr/local/nginx/conf/vhosts/zabbix.conf
1.server_name 2.root 3 添加index.php 4.root 5. fastcgi
server {
listen 80;
server_name 121.201.24.236;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /data/web/zabbixServer;
index index.php index.html index.htm;
}
location ~ \.php$ {
root /data/web/zabbixServer;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/web/zabbixServer$fastcgi_script_name;
include fastcgi_params;
}
12、修改php.ini文件
vi /usr/local/php/etc/php.ini
date.timezone = Asia/Shanghai
max_execution_time = 300
post_max_size = 32M
max_input_time = 300
mbstring.func_overload = 1
service php-fpm reload
接下来就可以在浏览器web配置http://121.201.24.236/setup.php
zabbix搭建