系统:Centos6.*
一、Lanmp环境部署
配置epel源
# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
#yum -y install gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-fpm php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp-devel curl-devel
service mysqld start
service httpd start
mysqladmin password redhat
(1)《源码安装zabbix》
#wget http://liquidtelecom.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.0.6/zabbix-2.0.6.tar.gz
#tar zxvf zabbix-2.0.6.tar.gz
# groupadd zabbix
# useradd zabbix -g zabbix
mysql> create database zabbix character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on zabbix.* to zabbix@localhost identified by 'rehat';
Query OK, 0 rows affected (0.02 sec)
# cd zabbx-2.0.6/database/mysql
# mysql -uzabbix -predhat zabbix < schema.sql
# mysql -uzabbix -p zabbix < images.sql
Enter password:
# mysql -uzabbix -p zabbix < data.sql
Enter password:
# cd zabbix-2.0.6
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl
make && make install
配置参数说明:
--enable-server 安装 Zabbix Server
--enable-proxy 安装 Zabbix Proxy
--enable-agent 安装 Zabbix Agent
--with-mysql 使用 mysql 做数据库服务器
--with-net-snmp 支持 SNMP
--with-libcurl 支持 curl,用于 web 监控
date.timezone = Etc/GMT+8
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
# cat /etc/services | grep zabbix*
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
zabbix-trapper 10051/udp # Zabbix Trapper
# egrep -v "(#|^$)" /usr/local/zabbix/etc/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
PidFile=/tmp/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=redhat
# cp misc/init.d/fedora/core/zabbix_server /etc/init.d
# chmod +x /etc/init.d/zabbix_server
# vi /etc/init.d/zabbix_server
BASEDIR=/usr/local/zabbix ##修改这个,zabbix的安装目录
CONFILE=$BASEDIR/etc/zabbix_server.conf ##添加这一行,定义配置文件位置
action $"Starting $BINARY_NAME: " $FULLPATH -c $CONFILE ##搜索start,修改启动选项,默认是去/etc下去找配置文件的
service zabbix_server start
cd zabbix-2.0.6
cp -r frontends/php /var/www/html/zabbix
chown -R apache:root /var/www/html/zabbix
PS:如果遇到如下数据库登录错误,需强制更改密码
// mysql登录错误
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
//解决办法:破解mysql密码
# service mysqld stop
# mysqld_safe --skip-grant-tables &
输入 mysql -uroot -p 回车进入
>use mysql;
> update user set password=PASSWORD("newpass")where user="root";
更改密码为 newpassord
> flush privileges; 更新权限
> quit 退出
# service mysqld restart
# mysql -uroot -p新密码进入
(2) 《yum 方式安装zabbix》
# rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
# yum install zabbix-server-mysql zabbix-web-mysql
# yum install zabbix-agent
# cd /usr/share/doc/zabbix-server-mysql-2.4.0/create
# mysql -uroot zabbix < schema.sql
# mysql -uroot zabbix < images.sql
# mysql -uroot zabbix < data.sql
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
# service httpd restart
# service mysqld restart
# service zabbix-server restart
# chkconfig httpd on && chkconfig mysqld on && chkconfig zabbix-server on
本文出自 “流星宇” 博客,谢绝转载!