标签:zabbix
需要搭建lnmp环境
1 nginx搭建
#tar –xvf nginx-1.5.9.tar.gz
#cd nginx-1.5.9
#./configure --prefix=/usr/local/nginx
#make&&make install
启动 /usr/local/nginx/sbin/nginx
重启 /usr/local/nginx/sbin/nginx -s reload
配置文件 /usr/local/conf/nginx/nginx.conf
增加用户www
#useradd www
#groupadd www
#chown -R www nginx/
#chgrp -R www nginx/
2 mysql搭建
#rpm –ivh percona_mysql-5.5.33-skyworth.el6.x86_64.rpm
配置与启动mysql,默认安装目录为/opt/percona/mysql
a) #cp support-files/my-medium.cnf /etc/my.cnf //建立mysql配置文件
b) #cp support-files/mysql.server /etc/init.d/mysqld //建立mysql启动脚本
c) 修改环境变量vim /etc/profile,
d) export PATH=/opt/percona/mysql/bin/:$PATH
e) 执行source /etc/profile使改动生效
1、 启动mysql
#service mysqld start
#mysql –u root –p //首次登入服务器不需要密码
2、 管理mysql,给root用户设置密码
#mysql –u root –p //登入系统
> update mysql.user set password=PASSWORD(“123456”) where user=’root’ ; //设置root密码
> flush privileges //刷新系统权限
3、 修改字符集
编辑/etc/my.cnf
在[mysqld]字段中添加
character-set-server = utf8,重启mysql
4、 设置开机启动mysql
#chkconfig mysqld on
mysql>create database zabbix character set utf8;
mysql>grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix‘;
mysql>flush privileges;
3 php搭建
#yum -y groupinstall "Develoment Tools" "Develoment Libraries"
#yum install -y curl curl-devel net-snmp snmp net-snmp-devel perl-DBI php-gd php-xml php-bcmath php-mbstring
#./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc --with-curl \
--enable-ftp --enable-sockets --disable-ipv6 --with-gd \
--with-jpeg-dir=/usr/local --with-png-dir=/usr/local \
--with-freetype-dir=/usr/local --enable-gd-native-ttf \
--with-iconv-dir=/usr/local --enable-mbstring --enable-calendar \
--with-gettext --with-libxml-dir=/usr/local --with-zlib \
--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
--enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath
#cd /usr/local
#chown -R www php/
#chgrp -R www php/
#vi /etc/php.ini
max_input_time = 600
max_execution_time = 300
date.timezone = Asia/Shanghai
post_max_size = 32M
memory_limit = 128M
4 zabbix搭建
#tar zxf zabbix-2.2.4.tar.gz
#./configure --prefix=/software/zabbix --enable-server --enable-agent \
--with-mysql=/software/mysql/bin/mysql_config --with-net-snmp
#make && make install
#mkdir /etc/zabbix
#cp misc/init.d/fedora/core/zabbix_server /etc/init.d/
#cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
#chmod 777 /etc/init.d/zabbix*
修改zabbix_agentd、zabbix_server程序目录的位置:
#vim /etc/init.d/zabbix_agentd
DAEMON=/usr/local/zabbix/sbin/zabbix_agentd
#vim /etc/init.d/zabbix_server
DAEMON=/usr/local/zabbix/sbin/zabbix_server
启动zabbix服务:
#service zabbix_agentd start
#service zabbix_server start
导入zabbix数据库
#mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/schema.sql
#mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/images.sql
#mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/data.sql
zabbix server与proxy需要数据库,angent不需要。尤其要注意的是proxy只需要导入一个sql文件,而server一共要 导入3个sql文件
编辑zabbix相关的配置文件
#vim /usr/local/zabbix/zabbix_agentd.conf
LogFile=/tmp/zabbix_agentd.log //客户端的日志文件
Server=127.0.0.1
Hostname=Zabbix Server
#vim /usr/local/zabbix/zabbix_server.conf
LogFile=/tmp/zabbix_server.log //服务端的日志文件
DBHost=192.168.0.240 //服务端ip
DBName=zabbix //zabbix数据库名字
DBUser=root //zabbix数据库登陆用户
9.提供zabbix的web文件
#mkdir -p /var/www/html/zabbix
#cp zabbix-2.2.2/frontends/php/* /var/www/html/zabbix
#chown -R www zabbix/
#chgrp -R www zabbix/
#chmod 755 zabbix
标签:zabbix
原文地址:http://yelei.blog.51cto.com/8337230/1615991