一、环境说明

CentOS6.5 64bit

zabbix2.2.2 

mysql-5.5.50

yum安装 lamp

二、软件安装配置

 #关闭防火墙和selinux

iptables -F 

iptables -X

iptables -L

service iptables save

service iptables stop

chkconfig iptables off

sed -i 's@^SELINUX=.*@SELINUX=disabled@' /etc/selinux/config

setenforce 0

#使用yum安装软件,首先安装 yum-fastestmirror 插件,用来找到最快的源。

yum install yum-fastestmirror -y 

# yum安装lamp组件

yum install make httpd php gcc net-snmp-devel curl-devel perl-DBI php-gd php-mysql php-bcmath php-mbstring php-xml ncurses-devel gcc*  libxml2-devel   msyql-devel -y

 

# 编译安装mysql-5.5.50

# yum安装基础组件

yum install gcc gcc-c++  wget  readline-devel zlib-devel openssl-devel -y

#下载安装cmake

cd /usr/local/src

wget

tar xf cmake-3.5.2.tar.gz

cd cmake-3.5.2

./bootstrap

make 

make install

# 下载安装mysql-5.5.50

cd /usr/local/src

wget

groupadd -r mysql

useradd -g mysql -r -s /sbin/nologin mysql

tar xf  mysql-5.5.50.tar.gz

cd mysql-5.5.50

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.50\

          -DMYSQL_DATADIR=/data0/mydata \

          -DSYSCONFDIR=/etc \

          -DWITH_INNOBASE_STORAGE_ENGINE=1 \

          -DWITH_ARCHIVE_STORAGE_ENGINE=1 \

          -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

          -DWITH_READLINE=1 \

          -DWITH_SSL=system \

          -DWITH_ZLIB=system \

          -DWITH_LIBWRAP=0 \

          -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \

          -DDEFAULT_CHARSET=utf8 \

          -DDEFAULT_COLLATION=utf8_general_ci

make 

make install

#初始化配置

cd /usr/local/mysql-5.5.50/

mkdir -pv /data0/mydata

chown -R  mysql.mysql /usr/local/mysql-5.5.50/

chown -R  mysql.mysql /data0/mydata/

 scripts/mysql_install_db --user=mysql --datadir=/data0/mydata/

cp support-files/mysql.server  /etc/init.d/mysqld

 chmod +x /etc/init.d/mysqld

 chkconfig --add mysqld

 chkconfig --list mysqld

cp -f support-files/my-small.cnf /etc/my.cnf

vim /etc/my.cnf

datadir = /data0/mydata

service mysqld start

mkdir -pv /var/lib/mysql

ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

vim  /etc/profile.d/mysql.sh 

export PATH=/usr/local/mysql-5.5.50/bin:$PATH

source /etc/profile.d/mysql.sh 

echo "/usr/local/mysql-5.5.50/lib/" > /etc/ld.so.conf.d/mysql-x86_64.conf

ldconfig

./bin/mysql_secure_installation

#创建zabbix数据库

mysql -u root -p

> create database zabbix character set utf8;

> grant all on zabbix.* TO zabbix@'localhost' identified by'123456';

> flush privileges;

# 安装配置zabbix

#添加用户

groupadd -r zabbix

useradd -r -g zabbix zabbix

cd /usr/local/src/

tar xf zabbix-2.2.2.tar.gz

cd zabbix-2.2.2

mysql -uzabbix -p123456 zabbix < database/mysql/schema.sql 

mysql -uzabbix -p123456 zabbix < database/mysql/p_w_picpaths.sql 

mysql -uzabbix -p123456 zabbix < database/mysql/data.sql

./configure --prefix=/usr/local/zabbix --with-mysql --with-net-snmp --with-libcurl --enable-server --enable-agent --enable-proxy --with-libxml2 --with-libcurl

make

make install

#添加端口

vim /etc/services

zabbix-agent    10050/tcp                       # Zabbix Agent

zabbix-agent    10050/udp                       # Zabbix Agent

zabbix-trapper  10051/tcp                       # Zabbix Trapper

zabbix-trapper  10051/udp                       # Zabbix Trapper

# 修改配置

vim /etc/httpd/conf/httpd.conf

DirectoryIndex index.html index.html.var index.php

DocumentRoot "/data0/zabbix/php"

vim /usr/local/zabbix/etc/zabbix_server.conf

DBName=zabbix

DBUser=zabbix 

DBPassword=123456

cp misc/init.d/fedora/core5/zabbix_server /etc/init.d/

cp misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/

chmod 700 /etc/init.d/zabbix_*

vim /etc/init.d/zabbix_server

ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_server"

vim /etc/init.d/zabbix_agentd

ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_agentd"

# 启动服务并设置开机启动项

/etc/init.d/zabbix_server start

/etc/init.d/zabbix_agentd start

chkconfig zabbix_server on

chkconfig zabbix_agentd on

# 修改php相关的配置

vi /etc/php.ini

max_execution_time = 300

max_input_time = 300

date.timezone = PRC

post_max_size = 32M

# 配置php文件

mkdir -pv /data0/zabbix

cp -rf  /usr/local/src/zabbix-2.2.2/frontends/php /data0/zabbix

chown -R zabbix:zabbix /data0/zabbix

# 安装fping

tar zxvf fping-3.5.tar.gz

cd fping-3.5

./configure

make

make install

vim /usr/local/zabbix/etc/zabbix_server.conf

FpingLocation=/usr/local/sbin/fping

# 启动httpd

service httpd start

chkconfig httpd on

#  页面配置

#文件下载下来,上传到相应的路径就好

#  初始用户admin   初始密码为zabbix

#完成