yum install httpd php mysql mysql-server php-pdo php-mysql gccgcc-c++ glibc mysql mysql-devel libxml2-devel curl-devel net-snmpnet-snmp-devel libssh2-devel OpenIPMI-devel php-gd php-xml php-mbstringphp-bcmath -y
[root@linux-node1~]# mkdir /home/oldboy/tools
[root@linux-node1~]# cd !$
cd/home/oldboy/tools
方法一
#上传软件包
[root@linux-node1tools]# rz
rzwaiting to receive.
开始zmodem 传输。 按Ctrl+C 取消。
100% 14660 KB 14660 KB/s 00:00:01 0 Errors
[root@linux-node1tools]# ll
total14664
-rw-r--r--1 root root 15012768 Nov 12 18:42 zabbix-2.4.7.tar.gz
方法二
#直接官网下载
wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.7/zabbix-2.4.7.tar.gz
/etc/init.d/httpd start
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? y
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
vim /etc/my.conf
###放在[mysql]下面
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
启动mysql
/etc/init.d/mysqld start
#第一次启动mysql数据库,会初始化数据库出现两次OK表示正常
cd /var/www/html/
cat info.php
<?php
phpinfo();
?>
###正常!
mysql #<=====进入数据库
mysql> createdatabase zabbix; #<=====创建zabbix库
mysql> grant all on zabbix.*to zabbix@localhost identified by 'zabbix'; #<=====授权zabbix管理用户
cd /home/oldboy/tools/
tar xfzabbix-2.4.7.tar.gz
[root@linux-node1tools]# cd zabbix-2.4.7/database/mysql/
[root@linux-node1mysql]# pwd
/home/oldboy/tools/zabbix-2.4.7/database/mysql
-rw-r--r-- 1 10001000 972946 Nov 12 18:39 data.sql
-rw-r--r-- 1 1000 10001978341 Nov 12 18:12 images.sql
-rw-r--r-- 1 10001000 104816 Nov 12 18:39 schema.sql
###将上面sql数据导入到mysql数据库中
#导入数据
mysql -u zabbix �Cp zabbix zabbix < images.sql
mysql -u zabbix -p zabbix zabbix < images.sql
mysql -u zabbix -pzabbix zabbix < data.sql
#给数据库root创建密码
mysqladmin -uroot password 123
#重新启动数据库
/etc/init.d/mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
#修改时区
[root@lb01 conf.d]# vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezoneAsia/Shanghai
#启动zabbix-server服务
/etc/init.d/zabbix-server start
cd /home/oldboy/tools/zabbix-2.4.7
./configure --prefix=/etc/zabbix/zabbix_server--enable-server --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl--with-libxml2 --with-openipmi --with-ssh2
***********************************************************
* Now run 'make install' *
* *
* Thank you for using Zabbix! *
* <http://www.zabbix.com> *
***********************************************************
make install
将zabbix程序移动到默认站点目录下
[root@linux-node1 zabbix-2.4.7]# cd frontends/php/
mv ./* /var/www/html/
chown apache.apache -R /var/www/html/
修改配置文件
cd /etc/zabbix/zabbix_server/etc
[root@linux-node1 etc]# pwd
/etc/zabbix/zabbix_server/etc
[root@linux-node1 etc]# ll
total 20
-rw-r--r-- 1 root root 13296 Dec 1210:03 zabbix_server.conf
drwxr-xr-x 2 root root 4096 Dec 12 10:03 zabbix_server.conf.d
[root@linux-node1 etc]# grep '^[a-Z]' zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
[root@linux-node1 etc]#
启动zabbix服务
/etc/zabbix/zabbix_server/sbin/zabbix_server -c /etc/zabbix/zabbix_server/etc/zabbix_server.conf
#终于tab完了,这个路径太长了,启动太麻烦
检查是否开启
lsof -i :10051 |wc -l
55
日志文件路径
tail -f /tmp/zabbix_server.log
报错:
解决方法:
vim /etc/php.ini #<====修改php配置文件
729 post_max_size = 16M
440 max_execution_time = 300
449 max_input_time = 300
946 date.timezone = PRC #<====PRC中华人民共和国
修改之后重启Apache服务
/etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
###就没有问题。
wget -O /etc/yum.repos.d/epel.repohttp:/ /mirrors.aliyun.com/repo/epel-6.repo
yum install zabbix22-agent -y
修改配置文件
[root@linux-node1 zabbix]# cat -n /etc/zabbix/zabbix_agentd.conf|grep 85
85 Server=127.0.0.1
185 ### Option: BufferSize
285 #Fullpath to location of agent modules.
[root@linux-node1 ~]# cat /etc/zabbix/zabbix_server.conf |grep -E"DBPassword|DBHost|DBUser"
DBHost=localhost
DBUser=zabbix
DBPassword=zabbix
/etc/zabbix/zabbix_agent start