安装nginx
- 安装依赖包
yum install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre* make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel
- 下载nginx安装包
wget http://nginx.org/download/nginx-1.10.3.tar.gz
- 解压nginx
tar xvf nginx-1.10.3.tar.gz
- 安装nginx
cd nginx-1.10.3
./configure --prefix=/opt/nginx
make -j8 && make install
安装php
- 下载php
wget http://cn2.php.net/get/php-5.5.35.tar.gz/from/this/mirror
- 安装php
mv mirror php-5.5.35.tar.gz && tar xvf php-5.5.35.tar.gz && cd php-5.5.35
./configure --prefix=/usr/local/product/php-5.5.35 --with-config-file-path=/usr/local/product/php-5.5.35/etc --with-bz2 --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-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath
make && make install
ln -s /usr/local/product/php-5.5.35 /usr/local/php
cp php.ini-production /usr/local/php/etc/php.ini
cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf
- 修改php参数(zabbix环境要求)
vim /usr/local/php/etc/php.ini
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
date.timezone = PRC
安装mysql
在mysql中创建zabbix数据库
mysql>create database zabbix default charset utf8;
mysql>grant all privileges on zabbix.* to zabbix@'%' identified by 'Abc@12345678';
mysql>flush privileges;
安装zabbix-server
- 下载zabbix-server
wget https://excellmedia.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.3/zabbix-3.2.3.tar.gz
- 安装依赖包
yum install mysql-devel -y
yum install net-snmp-devel -y
- 安装zabbix-server
./configure --prefix=/opt/zabbix-3.2.3/ --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
make -j8 && make install
- 创建zabbix用户
[root@localhost ~# groupadd zabbix
[root@localhost ~]# useradd zabbix -s /sbin/nologin -M -g zabbix
- mysql数据库中执行以下脚本,创建相应的表
[root@localhost ~]# mysql -uroot -pzabbix zabbix < database/mysql/schema.sql
[root@localhost ~]# mysql -uroot -pzabbix zabbix < database/mysql/images.sql
[root@localhost ~]# mysql -uroot -pzabbix zabbix < database/mysql/data.sql
zabbix管理网站配置
- 创建数据目录
[root@localhost ~]# mkdir /data/web/zabbix.lifec.com -p
[root@localhost ~]# mkdir /data/logs/zabbix -p
[root@localhost ~]# cp -rp frontends/php/* /data/web/zabbix.lifec.com/
- 配置nginx
server {
listen 8888;
server_name localhost;
access_log /opt/nginx/log/zabbix-access.log main;
index index.html index.php index.html;
location /{
try_files $uri $uri/ /index.php?$args;
}
location ~ ^(.+.php)(.*)$ {
fastcgi_split_path_info ^(.+.php)(.*)$;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
- 配置zabbix数据库连接信息
DBHost=10.230.20.101
DBName=zabbix
DBUser=zabbix
DBPassword=Abc@12345678
启动
- 启动nginx
/opt/nginx/sbin/nginx
- 启动php
/usr/local/php/sbin/php-fpm
- 启动zabbix-server
/opt/zabbix-3.2.3/sbin/zabbix_server
访问zabbix web端
zibbixIP:8888
根据提示完成相应信息的填写,默认用户名密码:admin/zabbix
网友评论