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. 小内存VPS apache并发控制参数prefork调优

    小内存VPS优化(使用wdcp lnamp一键包安装环境的情况下): 1.主要优化perfork模式下几个参数,防止开启过多的httpd进程占用大量内存导致内存满:在wdcp下修改的httpd配置文件 ...

  2. 使用nginx很卡之strace命令

    一.strace命令常用参数 strace -tt -T -v -f -e trace= -p -tt 在每行输出的前面,显示毫秒级别的时间 -T 显示每次系统调用所花费的时间 -v 对于某些相关调用 ...

  3. 阿里云 ECS 监控报警设置

    1.阿里云监控项说明 https://helpcdn.aliyun.com/document_detail/43505.html 2.监控设置 3.报警规则 4.设置阈值 5.确定即可. 6.效果图

  4. OD之修改文件标题(一)

    OD是逆向工程中的一个重要工具,逆向工程调试说明具体请参考:百度百科,OD介绍,当然就我了解而言,俗话就是破解软件,市面上的什么破解版,精简版啥的基本都是通过这种技术的,但是这并不能一概而论说逆向工程 ...

  5. Anibei前端基础学习

    html.html5.CSS2.CSS3.JQuery.Vue.js学习,后端程序媛开始学习前端开发啦.

  6. Unity光照与渲染设置学习笔记

    学习了一下unity中有关光照和渲染的一些设置,现在才明白之前遇到的一些问题只是没有正确设置而已. unity不同版本的光照设置会有一些差异,而且可以调节的参数非常多,这里只记录一些重要的参数和使用方 ...

  7. LintCode——全排列

    描述:给定一个数字列表,返回其所有可能的排列. 样例:给出一个列表[1,2,3],其全排列为:[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] 说明: ...

  8. A1043 Is It a Binary Search Tree (25 分)

    A Binary Search Tree (BST) is recursively defined as a binary tree which has the following propertie ...

  9. 20135316王剑桥Linux内核学习笔记第四周

    20135316王剑桥 <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC 1000029000 1.内核态:在高执行级别,代码可 ...

  10. 继承 多态 java相关基础知识

    1:静态语句块.构造语句块(就是只有大括号的那块)以及构造函数的执行顺序 例子: class HelloA { public HelloA() { System.out.println("H ...