环境

操作系统 最小化安装CentOS Linux release 7.2.1511
IP 192.168.88.1
zabbix版本 zabbix-3.4.4.tar.gz

zabbix依赖于LNMP环境部署

安装环境依赖包

yum install -y curl curl-devel net-snmp \
net-snmp-devel perl-DBI freetype freetype-devel \
libcurl-devel libxslt-devel pcre pcre-devel libevent-devel \
automake autoconf libtool gd gd-devel zlib zlib-devel openssl \
openssl-devel libxml2 libxml2-devel libjpeg libjpeg-devel libjpeg-turo-devel libpng libpng-devel

安装php

rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum --enablerepo=remi install php56 php56-php-fpm php56-php-mysqlnd php56-php-gd \
php56-php-xmlrpc php56-php-pecl-redis php56-php-mbstring php56-php-ldap
systemctl start php56-php-fpm
systemctl enable php56-php-fpm

启动后netstat -lntp查看9000端口是否起来

安装MySQL

yum install -y mariadb mariadb-server mairadb-devel

编辑/etc/my.cnf修改字符集为utf8

[mysqld]
...
character-set-server=utf8

启动数据库并设置密码为root,即账号密码为root/root,(这里演示用,实际生产环境设置复杂的密码)

systemctl restart mariadb
mysqladmin -uroot -p password 'root'

编译安装zabbix

tar xf zabbix-3.4..tar.gz

cd zabbix-3.4.
./configure \
--prefix=/opt/app/zabbix \
--enable-server \
--enable-agent \
--with-mysql \
--enable-bcmath \
--with-net-snmp \
--with-libcurl \
--with-libxml2 \
--enable-java #开启此功能需要安装jdk make install

创建普通用户zabbix, 因为zabbix不允许root用户运行

useradd zabbix
chown -R zabbix.zabbix /opt/app/zabbix

创建相关目录

cd /opt/app/zabbix
mkdir {logs,script} #存储日志和脚本的目录

在mysql创建数据库并导入数据

create database zabbix;
source /root/tools/zabbix-3.4./database/mysql/schema.sql
source /root/tools/zabbix-3.4./database/mysql/images.sql
source /root/tools/zabbix-3.4./database/mysql/data.sql

修改配置文件

[root@c1 etc]# cd /opt/app/zabbix/etc
[root@c1 etc]# grep -Ev "#|^$" zabbix_server.conf
LogFile=/opt/app/zabbix/logs/zabbix_server.log
PidFile=/opt/app/zabbix/logs/zabbix_server.pid
DBName=zabbix
DBUser=root
DBPassword=root
Timeout=
AlertScriptsPath=/opt/app/zabbix/script #指定脚本目录
LogSlowQueries= [root@c1 etc]# grep -Ev "#|^$" zabbix_agentd.conf
PidFile=/opt/app/zabbix/logs/zabbix_agentd.pid
LogFile=/opt/app/zabbix/logs/zabbix_agentd.log
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=c1.heboan.com

启动服务

/opt/app/zabbix/sbin/zabbix_server -c /opt/app/zabbix/etc/zabbix_server.conf
/opt/app/zabbix/sbin/zabbix_agentd -c /opt/app/zabbix/etc/zabbix_agentd.conf

安装web界面

安装nginx

useradd -s /sbin/nologin -M nginx
tar xf nginx-1.12..tar.gz
cd nginx-1.12. ./configure \
--prefix=/opt/app/nginx \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-cpu-opt=amd64 \
--with-pcre
make
make install

拷贝web文件到nginx目录

mkdir /opt/app/nginx/html/zabbix
cd ~/tools/zabbix-3.4.
cp -r frontends/php/* /opt/app/nginx/html/zabbix/

调整php参数

yum install *bcmath* --skip-broken

/opt/remi/php56/root/etc/php.ini
[Date] #在此行下添加如下一行
date.timezone = Asia/Shanghai 找到如下参数并修改
post_max_size = 20M
max_execution_time =
max_input_time =
always_populate_raw_post_data =
...
extension=bcmath.so #################
vim /opt/app/nginx/html/zabbix/include/classes/setup/CFrontendSetup.php
public function checkPhpAlwaysPopulateRawPostData() {
$current = ini_get('always_populate_raw_post_data');
$current = -; ####添加此行
return [
'name' => _s('PHP option "%1$s"', 'always_populate_raw_post_data'),
'current' => ($current != -) ? _('on') : _('off'),
'required' => _('off'),
'result' => ($current != -) ? self::CHECK_FATAL : self::CHECK_OK,
'error' => _s('PHP option "%1$s" must be set to "%2$s"', 'always_populate_raw_post_data', -)
];
} systemctl restart php56-php-fpm

配置nginx虚拟主机

server {
listen ;
server_name zabbix.heboan.com;
location / {
root /opt/app/nginx/html/zabbix;
index index.html index.htm index.php;
} location ~ \.php$ {
root /opt/app/nginx/html/zabbix;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
} access_log /opt/app/nginx/logs/zabbix.log; }

启动nginx,访问http://zabbix.heboan.com进行安装,安装完成后,默认的用户名密码是admin/zabbix

最新文章

  1. 关于C语言的一些trick
  2. Java开发搜索引擎爬虫
  3. iptables交互配置shell脚本
  4. JavaWeb项目开发案例精粹-第6章报价管理系统-06po层
  5. Using Sessions and Session Persistence---reference
  6. ETL工具之ODI
  7. linux apt-cache使用方法
  8. UNIX网络编程——原始套接字(dos攻击)
  9. vue路由--网站导航功能
  10. Kotlin基础
  11. Mycat的读写分离
  12. 阿里云搭建JAVA WEB环境(SQL Server + TomCat + 配置域名)
  13. account
  14. 洛谷 P1824 进击的奶牛 【二分答案】(求最大的最小值)
  15. 如何在github上创建仓库,并将本地的文件上传到对应的远程仓库
  16. 继承类中static数据值
  17. ckeditor:新增时会得到上次编辑的内容
  18. CentOS重置Mysql密码
  19. layout/reflow
  20. 英特尔老款CPU支持虚拟化对照表(转)

热门文章

  1. CAS(硬件CPU同步原语)
  2. 【BZOJ】1552/3506 [Cerc2007]robotic sort
  3. 【BZOJ】1666 [Usaco2006 Oct]Another Cow Number Game 奶牛的数字游戏
  4. Spring 路由地址的基本使用
  5. 24、redis中的sentinel的作用?
  6. ifa_local 和 ifa_address
  7. sicily 1036. Crypto Columns
  8. 【模板】SPOJ FACT0 大数分解 miller-rabin & pollard-rho
  9. [New learn]AutoLayout调查基于IB
  10. C语言inline函数(转)