博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Centos 6.8 x86_64安装zabbix3.2.7
阅读量:6081 次
发布时间:2019-06-20

本文共 5442 字,大约阅读时间需要 18 分钟。

hot3.png

Centos 6.8 x86_64平台  LNMP+zabbix

1安装php7.0

rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
yum install -y php70w php70w-bcmath php70w-common php70w-cli php70w-mysql php70w-pdo php70w-gd php70w-fpm php70w-intl php70w-mbstring php70w-mcrypt php70w-xml php70w-xmlrpc php70w-opcache php70w-ldap php70w-pear

sed -i 's/post_max_size = 8M/post_max_size = 16M/g' /etc/php.ini

sed -i 's/max_input_time = 60/max_input_time = 300/g' /etc/php.ini
sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php.ini
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php.ini
sed -i 's/;date.timezone =/date.timezone = PRC/g' /etc/php.ini

service php-fpm start

2,nginx的安装(当前版本1.12.1)

rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
yum install -y nginx

3,安装mysql5.6.37

rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

yum install -y mysql-community-server mysql-community-devel

mysql的基础配置(根据系统硬件配置)my.cnf

[client]
port        = 3306
default-character-set=utf8

[mysqld]

port        = 3306
skip-name-resolve
character-set-server=utf8
skip-external-locking
max_connections=1000
max_connect_errors=10
default-storage-engine=INNODB
innodb_log_file_size = 128M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 2
innodb_lock_wait_timeout = 50
innodb_flush_method=O_DIRECT

default-time-zone = '+8:00'

event_scheduler=ON
open_files_limit=51200

service mysqld start

mysql_secure_installation

4,nginx和php的融合

mkdir -p /var/www/html
chown -R nginx:nginx /var/www/html
vi /etc/nginx/conf.d/default.conf
    #location / {
        root   /var/www/html;
        index  index.php index.html index.htm;
    #}
 
location ~ \.php$ {
    #    root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcig_read_timeout 120;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

service nginx start

echo '<?php phpinfo(); ?>' > /var/www/html/index.php

http://IP检验lnmp安装成功

5,系统内核参数调整(针对nginx和php)

cat >> /etc/security/limits.conf<<-EOF
* soft nofile 65535
* hard nofile 65535
EOF

cat >> /etc/sysctl.conf<<-EOF
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_keepalive_time = 30
                                 
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 8000                             
net.core.somaxconn = 262144
                                 
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_intvl = 20
                                 
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
                                 
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216                              
net.core.netdev_max_backlog = 32768
                                 
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_retries2 = 5
                                 
net.ipv4.tcp_mem = 41943040 73400320 94371840
net.ipv4.tcp_max_orphans = 3276800
fs.file-max = 1300000

kernel.printk_ratelimit = 30

kernel.printk_ratelimit_burst = 200
EOF
sysctl -p使生效

6,安装zabbix server
zabbix只会以普通用户运行,如果root环境下运行,zabbix会主动尝试以zabbix身份运行,若系统没有zabbix用户需建立
groupadd zabbix
useradd -g zabbix zabbix

yum install -y net-snmp-devel curl curl-devel libxml2-devel

wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.2.7/zabbix-3.2.7.tar.gz

tar zxvf zabbix-3.2.7.tar.gz
cd zabbix-3.2.7
./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
make && make install

mysql -u root -p

mysql>create database zabbix default charset utf8;
mysql>use zabbix;
mysql>source /root/zabbix-3.2.7/database/mysql/schema.sql
mysql>source /root/zabbix-3.2.7/database/mysql/images.sql
mysql>source /root/zabbix-3.2.7/database/mysql/data.sql
mysql>grant all privileges on zabbix.* to 'zabbix'@'%' identified by 'uiop789';
mysql>flush privileges;
mysql>exit

vi /usr/local/etc/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=uiop789
DBPort=3306

启动zabbix_server

/usr/local/sbin/zabbix_server -c /usr/local/etc/zabbix_server.conf
默认端口10051
netstat -anp | grep 10051
tcp        0      0 0.0.0.0:10051               0.0.0.0:*                   LISTEN      23830/zabbix_server

配置客户端(监控sever本身)

vi /usr/local/etc/zabbix_agentd.conf

Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server

启动客户端(客户端和服务端时间同步,设置crontab:0 0 * * * /usr/sbin/ntpdate -U 210.72.145.44)

/usr/local/sbin/zabbix_agentd -c /usr/local/etc/zabbix_agentd.conf

netstat -anp | grep 10050

关闭killall zabbix_agentd

拷贝前端文件

cp -rp frontens/php/* /var/www/html/zabbix/
chown nginx.nginx -R /var/www/html/zabbix/

根据以上设置直接http://IP/zabbix,即可看到前端配置提示,当然你也可以自定义vhost后重启nginx

登录zabbix 默认用户名:Admin:zabbix

单机Admin图像在language里选择Chinese_simple,update后界面就变成中文的了,随后添加模板、添加主机、各种监控走起

cp /root/zabbix-3.2.7/misc/init.d/fedora/core5/* /etc/init.d/

service zabbix_server start/stop/restart
service zbbbix_agentd start/stop/restart

chkconfig --add zabbix_server

chkconfig --add zabbix_agentd

chkconfig --list zabbix_server

chkconfig --list zabbix_agentd

chkconfig --level 35 zabbix_server on

chkconfig --level 35 zabbix_agentd on

客户端独立安装zabbix_agentd

wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.2.7/zabbix-3.2.7.tar.gz
tar zxvf zabbix-3.2.7.tar.gz
cd zabbix-3.2.7
./configure --enable-agent
make && make install

vi /usr/local/etc/zabbix_agentd.conf

Server=zabbix_server IP

ServerActive=zabbix_server IP
Hostname=uniq_name_client

groupadd zabbix

useradd -g zabbix zabbix
启动:/usr/local/sbin/zabbix_agentd -c /usr/local/etc/zabbix_agentd.conf

转载于:https://my.oschina.net/u/2404183/blog/910444

你可能感兴趣的文章
开年巨制!千人千面回放技术让你“看到”Flutter用户侧问题
查看>>
开源磁盘加密软件VeraCrypt教程
查看>>
本地vs云:大数据厮杀的最终幸存者会是谁?
查看>>
阿里云公共镜像、自定义镜像、共享镜像和镜像市场的区别 ...
查看>>
shadowtunnel v1.7 发布:新增上级负载均衡支持独立密码
查看>>
Java线程:什么是线程
查看>>
mysql5.7 创建一个超级管理员
查看>>
【框架整合】Maven-SpringMVC3.X+Spring3.X+MyBatis3-日志、JSON解析、表关联查询等均已配置好...
查看>>
要想成为高级Java程序员需要具备哪些知识呢?
查看>>
带着问题去学习--Nginx配置解析(一)
查看>>
onix-文件系统
查看>>
java.io.Serializable浅析
查看>>
我的友情链接
查看>>
多线程之线程池任务管理通用模板
查看>>
CSS3让长单词与URL地址自动换行——word-wrap属性
查看>>
CodeForces 580B Kefa and Company
查看>>
开发规范浅谈
查看>>
Spark Streaming揭秘 Day29 深入理解Spark2.x中的Structured Streaming
查看>>
鼠标增强软件StrokeIt使用方法
查看>>
本地连接linux虚拟机的方法
查看>>