https://mp.weixin.qq.com/s/ogaqiX4vhtGLepuNf-1ItA

zabbix依赖LNMP或LAMP,下面讲解LNMP安装到zabbix web页面的访问。

一、nginx安装

安装依赖

  • yum -y install wget openssl* gcc gcc-c++autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devellibxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-develkrb5 krb5-devel libidn libidn-devel openssl openssl-devel openldapopenldap-devel nss_ldap openldap-clients openldap-servers make gd gd2 gd-develgd2-devel libxslt libxslt-devel libaio libaio-devel

下载nginx

  • cd /usr/local/src

  • wget http://nginx.org/download/nginx-1.14.0.tar.gz

创建启动nginx用户

  • groupadd www

  • useradd -r -g www www

安装nginx

  • tar xf nginx-1.14.0.tar.gz

  • cd nginx-1.14.0

  • ./configure--user=www --group=www --prefix=/opt/nginx1.4

  • make && make install

关闭防火墙、selinux

  • systemctl stop firewalld.service

  • setenforce 0

启动nginx

  • /opt/nginx1.4/sbin/nginx

浏览器访问

二、安装mysql5.7

下载mysql

  • cd /usr/local/src

  • wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz

创建mysql用户和用户组

  • groupadd mysql

  • useradd-r -g mysql mysql

解压安装并创建logs和data目录

  • tar xf mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz

  • mvmysql-5.7.12-linux-glibc2.5-x86_64 /opt/mysql5.7

  • cd /opt/mysql5.7/

  • mkdir data logs

  • echo "" > logs/error.log

初始化mysql

  • bin/mysql_install_db --user=mysql --basedir=/opt/mysql5.7/ --datadir=/opt/mysql5.7/data/

授权

  • cd /opt/

  • chown -R mysql.mysql mysql5.7

拷贝启动脚本

  • cd /opt/mysql5.7

  • cpsupport-files/mysql.server /etc/init.d/mysqld

修改启动脚本

  • vim /etc/init.d/mysqld

basedir=/opt/mysql5.7

datadir=/opt/mysql5.7/data

拷贝配置文件然后自己根据需要对配置文件进行修改或自己写,这里我是自己写的

  • vim /etc/my.cnf

[client]

port=3306

socket=/tmp/mysql.sock

default-character-set=utf8

[mysql]

no-auto-rehash

default-character-set=utf8

[mysqld]

user    = mysql

port    = 3306

basedir =/opt/mysql5.7

datadir =/opt/mysql5.7/data

socket  = /tmp/mysql.sock

pid-file= mysql3306.pid

log-error=/opt/mysql5.7/logs/error.log

skip_name_resolve= 1

open_files_limit    = 65535

back_log= 1024

max_connections= 1500

max_connect_errors= 1000000

table_open_cache= 1024

table_definition_cache= 1024

table_open_cache_instances= 64

thread_stack= 512K

external-locking= FALSE

max_allowed_packet= 32M

sort_buffer_size= 16M

join_buffer_size= 16M

thread_cache_size= 2250

query_cache_size= 0

query_cache_type= 0

interactive_timeout= 600

wait_timeout= 600

tmp_table_size= 96M

max_heap_table_size= 96M

###***slowqueryparameters

long_query_time= 0.1

slow_query_log= 1

slow_query_log_file= /opt/mysql5.7/logs/slow.log

###***binlogparameters

log-bin=mysql-bin

binlog_cache_size=4M

max_binlog_cache_size=8M

max_binlog_size=1024M

binlog_format=MIXED

expire_logs_days=7

###***master-slavereplicationparameters

server-id=3306

#slave-skip-errors=all

[mysqldump]

quick

max_allowed_packet=32M

添加变量

  • vim /etc/profile

#mysql

exportPATH=$PATH:/opt/mysql5.7/bin

  • source /etc/profile

启动mysql

  • /etc/init.d/mysqld start

查看初始密码

  • cat /root/.mysql_secret

登陆数据库,修改密码

  • mysql -uroot -p‘password’

>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password');

>FLUSH PRIVILEGES;

三、安装PHP

安装依赖libmcrypt

  • cd /usr/local/src

  • tar xf libmcrypt-2.5.8.tar.gz

  • cd libmcrypt-2.5.8

  • ./configure

  • make && make install

  • /sbin/ldconfig

  • cd libltdl/

  • ./configure --enable-ltdl-install

  • make&& make install

  • ln -sf/usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la

  • ln -sf/usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so

  • ln -sf/usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4

  • ln -sf/usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8

  • ldconfig

安装依赖库mhash

  • cd /usr/local/src

  • tar xfmhash-0.9.9.9.tar.gz

  • cd mhash-0.9.9.9

  • ./configure

  • make && make install

  • ln -sf/usr/local/lib/libmhash.a /usr/lib/libmhash.a

  • ln -sf/usr/local/lib/libmhash.la /usr/lib/libmhash.la

  • ln -sf/usr/local/lib/libmhash.so /usr/lib/libmhash.so

  • ln -sf/usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2

  • ln -sf/usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1

  • ldconfig

安装依赖库mcrypt

  • cd /usr/local/src

  • tar xf mcrypt-2.6.8.tar.gz

  • cdmcrypt-2.6.8

  • ./configure

  • make && make install

安装PHP

  • cd /usr/local/src

  • tar xf php-7.2.6.tar.gz

  • cd php-7.2.6

  • ./configure --prefix=/opt/php7.2--with-config-file-path=/opt/php7.2/etc --enable-fpm --with-fpm-user=www--with-fpm-group=www --with-mysqli --with-pdo-mysql --with-iconv-dir--with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex--enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf--with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc--enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo--enable-maintainer-zts --enable-opcache --with-xsl

  • make && make install

修改配置文件

  • cd /usr/local/src/php-7.2.6

  • cp php.ini-development /opt/php7.2/etc/php.ini

  • cp sapi/fpm/php-fpm.conf /opt/php7.2/etc/

  • cd /opt/php7.2/etc/php-fpm.d

  • cp www.conf.default www.conf

拷贝启动脚本

  • cd /usr/local/src/php-7.2.6

  • cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

  • chmod 755 /etc/init.d/php-fpm

设置环境变量

  • vim/etc/profile

#php

exportPHP_HOME=/opt/php7.2

exportPATH=$PATH:$PHP_HOME/bin

  • source/etc/profile

启动php-fpm

  • /etc/init.d/php-fpm start

四、安装zabbix

安装依赖库

  • yum -yinstall net-snmp-devel libxml2-devel libcurl-deve libevent libevent-devel

创建zabbix用户

  • groupadd zabbix

  • useradd -r -g zabbix zabbix

  • cd /usr/local/src

  • tar xf zabbix-3.4.12.tar.gz

  • cdzabbix-3.4.12

  • ./configure--prefix=/opt/zabbix3.4 --enable-server --enable-agent --enable-java--with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2

  • make && make install

  • cd /opt

  • chown -R zabbix.zabbix zabbix3.4

创建zabbix数据库并导入数据

  • mysql -uroot -p‘password’

    mysql>create database if not exists zabbix default character set utf8 collateutf8_general_ci;

    mysql>grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';

    mysql>use zabbix;

    mysql>source /usr/local/src/zabbix-3.4.12/database/mysql/schema.sql;

    mysql>source /usr/local/src/zabbix-3.4.12/database/mysql/images.sql;

    mysql>source /usr/local/src/zabbix-3.4.12/database/mysql/data.sql;

创建日志目录

  • cd /opt/zabbix3.4

  • mkdir logs

  • chown zabbix.zabbix logs

修改zabbix_server.conf

  • cd /opt/zabbix3.4

  • vim etc/zabbix_server.conf

ListenPort=15100

LogFile=/opt/zabbix3.4/logs/zabbix_server.log

PidFile=/tmp/zabbix_server.pid

DBHost=localhost

DBName=Zabbix

DBUser=Zabbix

DBPassword=zabbix

DBSocket=/tmp/mysql.sock

DBPort=3306

JavaGateway=127.0.0.1

JavaGatewayPort=15200

StartJavaPollers=3

AlertScriptsPath=/opt/zabbix3.4/zabbix/alertscripts

Include=/opt/zabbix3.4/etc/zabbix_server.conf.d/*.conf

  • mkdir -p zabbix/alertscripts

  • chown -R zabbix.zabbix zabbix

启动zabbix_server

  • /opt/zabbix3.4/sbin/zabbix_server

如提示一下错误

/opt/zabbix3.4/sbin/zabbix_server:error while loading shared libraries: libmysqlclient.so.20: cannot open sharedobject file: No such file or directory

则创建链接

  • ln -s/opt/mysql5.7/lib/libmysqlclient.so.20 /usr/lib/

拷贝应用程序,/opt/nginx1.4/html/为nginx运行PHP程序的目录

  • cd /usr/local/src/zabbix-3.4.12/frontends/php

  • cp -r ./* /opt/nginx1.4/html/

  • cd /opt/nginx1.4/

  • chown -Rzabbix.zabbix html

修改nginx配置文件

  • vim /opt/nginx1.4/conf/nginx.conf

location ~ \.php$ {

root           html;

fastcgi_pass   127.0.0.1:9000;

fastcgi_index  index.php;

#fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

fastcgi_param SCRIPT_FILENAME$document_root$fastcgi_script_name;

include        fastcgi_params;

}

location ~*^.+\.(ico|gif|jpg|jpeg|png|html|css|htm|bmp|js|svg)$ {

root           html;

}

重启nginx

  • /opt/nginx1.4/sbin/nginx -s reload

浏览器访问:ip/index.php

xxx.xxx.xxx.xxx/index.php

修改php配置文件

  • vim /opt/php7.2/etc/php.ini

post_max_size= 16M

max_execution_time= 300

max_input_time= 300

date.timezone = Asia/Shanghai

重启PHP

  • /etc/init.d/php-fpm restart

刷新浏览器

下载之后保存到提示的目录下面/opt/nginx1.4/html/conf/:

  • ll /opt/nginx1.4/html/conf/zabbix.conf.php

刷新页面

默认用户名:Admin

默认密码:zabbix

修改密码和语言:

发现换成中文之后出现乱码

解决

确定zabbix开启了中文支持

  • vim /opt/nginx1.4/html/include/locales.inc.php

从window10拷贝字体

上传到服务器

  • cd /opt/nginx1.4/html/fonts

将之前字体备份

  • mv DejaVuSans.ttf /tmp/

换成拷贝的字体

  • ll simhei.ttf

修改字体文件

  • cd /opt/nginx1.4/html/include

  • sed -i 's/DejaVuSans/simhei/g' defines.inc.php

刷新页面,乱码问题解决

zabbix server本机监控

  • vim /opt/zabbix3.4/etc/zabbix_agentd.conf

PidFile=/tmp/zabbix_agentd.pid

LogFile=/opt/zabbix3.4/logs/zabbix_agentd.log

Server=127.0.0.1            #被动模式

ListenPort=15000

ServerActive=127.0.0.1:15100      #主动模式

Hostname=ZabbixServer

Include=/opt/zabbix3.4/etc/zabbix_agentd.conf.d/*.conf

启动zabbix_agent

  • /opt/zabbix3.4/sbin/zabbix_agentd

到这里zabbix server的基本安装就完成了,如有不明白的地方,公众号留言,后面会介绍zabbix agent的安装以及zabbix基本配置,谢谢关注!!!

zabbix server安装(二)的更多相关文章

  1. zabbix server安装详解

    简介 zabbix(音同 zæbix)是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案. zabbix能监视各种网络参数,保证服务器系统的安全运营:并提供灵活的通知机制以 ...

  2. zabbix server 安装部署

    一:安装zabbix服务端 1.部署准备 命令:iptables -F     #关闭防火墙命令:systemctl stop firewalld    #关闭防火墙 设置解析,自建yum源 命令:c ...

  3. zabbix server源码安装

    一.准备工作 yum -y install net-snmp-devel php-bcmath php-ctype php-xml php-xmlreader php-xmlwriter php-se ...

  4. Centos 6.5 下安装 Zabbix server 3.0服务器的安装及 监控主机的加入(2)

    一.Centos 6.5 下的Zabbix Server安装 上篇文章记录的是centos 7 下安装zabbix ,很简单.但是6.5上面没有可用的源直接安装zabbix,所以需要从别处下载.感谢i ...

  5. 基于LNMP的Zabbbix之Zabbix Server源码详细安装,但不给图

    Zabbix Server安装 看到那里有错或者有什么问题的话,求指点 邮箱:losbyday@163.com 上一篇PHP源码安装参见基于LNMP的Zabbbix之PHP源码安装:https://i ...

  6. zabbix agent安装(三)

    转载于https://mp.weixin.qq.com/s/33ab-JLoRfMkeI4aZDciJQ 前一篇文章介绍了zabbix server安装,这篇文章主要讲解zabbix agent安装以 ...

  7. 【Zabbix】Zabbix Server自动发现

    Zabbix自动发现 由于有上百台的虚拟机需要监控,如果一个个去添加配置,费时费力.Zabbix的自动发现,可以自动发现需要监控的机器,监控相应指标. 前置条件 安装部署好Zabbix Server. ...

  8. Zabbix Server和MPM(monitor for mysql)的高速部署

    1. 前言         zabbix作为开源免费的监控软件.其易于管理配置和可视化的视图.历史数据的定期维护.模板化的监控项目越来越受到广大IT运维人员的喜爱. 这里主要是总结了下Zabbix S ...

  9. zabbix server&proxy部署操作过程

    zabbix server&proxy部署操作过程 系统:ubuntu20.04 zabbix版本: 5.4 安装zabbix server 安装方式: 包管理安装,docker,源码,app ...

随机推荐

  1. 配置yum,nc,telnet

    一.学习中问题 最近学习在学习Hadoop的一个子项目Zookeeper,在测试其中的“四字命令”---”echo ruok|nc localhost 2181“时发现命令无法被识别,如下图所示: [ ...

  2. [CF981F]Round Marriage[二分+霍尔定理]

    题意 洛谷 分析 参考了Icefox 首先二分,然后考虑霍尔定理判断是否有完美匹配.如果是序列的话,因为这里不会出现 \(j<i,L(i)<L(j)\) 或者 \(j<i,R(i)& ...

  3. 【Android UI设计与开发】第03期:引导界面(三)仿微信引导界面以及动画效果

    基于前两篇比较简单的实例做铺垫之后,这一篇我们来实现一个稍微复杂一点的引导界面的效果,当然也只是稍微复杂了一点,对于会的人来说当然还是so easy!正所谓会者不难,难者不会,大概说的就是这个意思了吧 ...

  4. DokuWiki 使用

    新建文件夹 修改url, 将新文件夹的名称赋值给url上的id, 如要建一个"DokuWiki"的文件夹,并在文件夹下新增一个"QuickStart"的页面,改 ...

  5. 【DDD】业务建模实践 —— 发布帖子

    本文是基于上一篇‘业务建模战术’的实践,主要讲解‘发表帖子’场景的业务建模,包括:业务建模.业务模型.示例代码:示例代码会使用java编写,文末附有github地址.相比于<领域驱动设计> ...

  6. Asp.Net_Get跟Post

    1. Get(即使用QueryString显式传递)     方式:在url后面跟参数.     特点:简单.方便.     缺点:字符串长度最长为255个字符:数据泄漏在url中.     适用数据 ...

  7. 如何使用SVN

    如何正确高效地管理软件的版本是一件让人头疼的事情,使用SVN是一个不错的选择.下面简要介绍SVN在windows xp和redhat两种平台下的使用.SVN软件包括服务器端和客户端程序. 1.如何在W ...

  8. unity音量设置(同时设置到多个物体上)——引伸语言设置

    在游戏中游戏设置是一个很重要的功能,但是比如语言设置和音量设置分散在很多个物体的组件上,如果每个对应的物体都放到一个链表里,会导致程序雍总难堪,使用事件调用是最好的方式 音量存储类 SoundMana ...

  9. X32位 天堂2 二章/三章 服务端协议号修改方法

    [本方法适合于2004-2006年之间天堂2由初章服务端修改至二章.三章端时协议号匹配问题]服务端版本位32位初章服务端 目前大部分SF用的协议号情况: 服务端是419 客户端是 417 419 42 ...

  10. spark执行在yarn上executor内存不足异常ERROR YarnScheduler: Lost executor 542 on host-bigdata3: Container marked as failed: container_e40_1550646084627_1007653_01_000546 on host: host-bigdata3. Exit status: 143.

    当spark跑在yarn上时 单个executor执行时,数据量过大时会导致executor的memory不足而使得rdd  最后lost,最终导致任务执行失败 其中会抛出如图异常信息 如图中异常所示 ...