`

CentOS7 npm+zabbix 安装配置

阅读更多

mini安装centos7

更新yum源

yum -y install net-tools wget lrzsz lsof
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum clean all
yum makecache

 

安装依赖库

yum -y remove selinux*
yum -y update
yum -y install pcre pcre-devel openssl openssl-devel gcc-c++
systemctl stop firewalld.service
systemctl disable firewalld.service

 

 安装nginx

cd /home/
useradd -s /sbin/nologin -M nginx
wget http://nginx.org/download/nginx-1.13.8.tar.gz
tar -zxvf nginx-1.13.8.tar.gz
cd nginx-1.13.8
./configure --user=nginx --group=nginx --prefix=/application/nginx-1.13.8 --with-http_stub_status_module --with-http_ssl_module
make && make install
ln -s /application/nginx-1.13.8/ /application/nginx
cd /application/nginx/conf
egrep -v "#|^$" nginx.conf.default > nginx.conf

 

 配置nginx

vi /application/nginx/conf/nginx.conf

worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    client_max_body_size 8M;
    client_body_buffer_size 128k;
    server {
        listen       80;
        server_name  localhost;
        location / {
            root   html;
            index  index.php index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        location ~\.(php|php5)?$ {
                root /application/nginx/html;
                fastcgi_read_timeout 150;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME /application/nginx/html$fastcgi_script_name;
                include    fastcgi_params;
        }
    }
}

 /application/nginx/sbin/nginx -t


 nginx自启设置

vi /lib/systemd/system/nginx.service

Description=nginx  
After=network.target  
   
[Service]  
Type=forking  
ExecStart=/application/nginx/sbin/nginx  
ExecReload=/application/nginx/sbin/nginx -s reload
ExecStop=/application/nginx/sbin/nginx -s stop
PrivateTmp=true  
   
[Install]  
WantedBy=multi-user.target

systemctl enable nginx.service

systemctl start nginx.service



 

安装PHP环境

cd /home/
wget http://cn2.php.net/distributions/php-5.6.32.tar.gz
cd php-5.6.32
yum install -y epel-release
yum -y install libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel

./configure --prefix=/application/php-5.6.32 --with-mysql --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --with-gettext --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=nginx --with-fpm-group=nginx --enable-ftp --enable-opcache=no
make && make install

ln -s /application/php-5.6.32/ /application/php
cp php.ini-production /application/php/lib/php.ini
cp /application/php/etc/php-fpm.conf.default /application/php/etc/php-fpm.conf

php-fpm自动启动

vi /lib/systemd/system/php-fpm.service

[Unit]
Description=php
After=network.target

[Service]
Type=forking
ExecStart=/application/php/sbin/php-fpm
ExecStop=pkill -9 php-fpm
PrivateTmp=true

[Install]
WantedBy=multi-user.target

systemctl enable php-fpm.service

systemctl start php-fpm.service


安装mysql

cd /home/
 wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
rpm -ivh mysql57-community-release-el7-8.noarch.rpm 
yum repolist enabled | grep "mysql.*-community.*"
yum install mysql-community-server mysql-devel -y
systemctl start mysqld.service
systemctl enable mysqld.service

初始化mysql密码:

more /var/log/mysqld.log
[Note] A temporary password is generated for root@localhost: aYXccWSPA7<-

mysql -uroot -p
Enter password:aYXccWSPA7<-

5.7.6以及之后的版本修改密码的命令为:
ALTER USER 'root'@'localhost' IDENTIFIED BY '!@QWASZX1q2w3e4r';
mysql>

 

安装zabbix 

yum -y install mysql-devel net-snmp-devel  libevent  libevent-devel

cd /home/
wget https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.5/zabbix-3.4.5.tar.gz
cd zabbix-3.4.5

groupadd zabbix
useradd -g zabbix zabbix

./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
make && make install

mkdir -p /usr/local/zabbix/logs
chown -R zabbix.zabbix /usr/local/zabbix/logs

mv /usr/local/zabbix/etc/zabbix_server.conf /usr/local/zabbix/etc/zabbix_server.conf.bak
mv /usr/local/zabbix/etc/zabbix_agentd.conf /usr/local/zabbix/etc/zabbix_agentd.conf.bak

 vi /usr/local/zabbix/etc/zabbix_server.conf

LogFile=/usr/local/zabbix/logs/zabbix_server.log
PidFile=/usr/local/zabbix/logs/zabbix_server.pid
DBHost=172.29.10.21
DBName=zabbix
DBUser=zabbix
DBPassword=!@QWASZX1q2w3e4r
ListenIP=0.0.0.0
Timeout=4
FpingLocation=/usr/sbin/fping
AlertScriptsPath=/usr/local/zabbix/shell
LogSlowQueries=3000

 

vi /usr/local/zabbix/etc/zabbix_agentd.conf

LogFile=/usr/local/zabbix/logs/zabbix_agentd.log
PidFile=/usr/local/zabbix/logs/zabbix_agentd.pid
Server=172.16.33.20,172.16.33.22,172.16.33.23,172.29.10.20,172.29.10.1
ServerActive=127.0.0.1
Hostname=WebSvn
UserParameter=Rec_Count[*],/script/test $1
UserParameter=Rec_Dva[*],/script/test $1
UserParameter=Avaya_Count[*],/script/avaya/avaya $1
UserParameter=count[*],python /script/py/count.py $1
UserParameter=avaya_trunk[*],python /script/py/avaya_trunk.py $1 $2 $3 $4
UserParameter=area_call_count[*],python /script/py/area_call_count.py $1 $2
UserParameter=business[*],python /script/py/business_number_count.py $1 $2

 

设置zabbix自动启动

cd /home/zabbix-3.4.5/misc/init.d/tru64
cp zabbix_* /etc/init.d/
chmod +x /etc/init.d/zabbix_*

vi /etc/init.d/zabbix_server
SERVICE="Zabbix server"
DAEMON=/usr/local/zabbix/sbin/zabbix_server
PIDFILE=/usr/local/zabbix/logs/zabbix_server.pid

vi /etc/init.d/zabbix_agentd 
SERVICE="Zabbix agent"
DAEMON=/usr/local/zabbix/sbin/zabbix_agentd
PIDFILE=/usr/local/zabbix/logs/zabbix_agentd.pid

ln -s /usr/local/zabbix/etc/* /usr/local/etc

 

 

vi /lib/systemd/system/zabbix_server.service 

[Unit]  
Description=zabbix_server
After=network.target  
   
[Service]  
Type=forking  
ExecStart=/etc/init.d/zabbix_server start
ExecReload=/etc/init.d/zabbix_server restart
ExecStop=/etc/init.d/zabbix_server stop
PrivateTmp=true  
   
[Install]  
WantedBy=multi-user.target

 

vi /lib/systemd/system/zabbix_agentd.service 

[Unit]
Description=zabbix_agentd
After=network.target

[Service]
Type=forking
ExecStart=/etc/init.d/zabbix_agentd start
ExecReload=/etc/init.d/zabbix_agentd restart
ExecStop=/etc/init.d/zabbix_agentd stop
PrivateTmp=true

[Install]
WantedBy=multi-user.target

 

 

创建数据库

create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by '!@QWASZX1q2w3e4r';
grant all privileges on zabbix.* to zabbix@'%'  identified by '!@QWASZX1q2w3e4r';
flush privileges;
exit

cd /home/zabbix-3.4.5
mysql -uzabbix -p!@QWASZX1q2w3e4r zabbix < /home/zabbix-3.4.5/database/mysql/schema.sql
mysql -uzabbix --p!@QWASZX1q2w3e4r zabbix < /home/zabbix-3.4.5/database/mysql/images.sql
mysql -uzabbix --p!@QWASZX1q2w3e4r zabbix < /home/zabbix-3.4.5/database/mysql/data.sql

 

systemctl start zabbix_server.service

systemctl start zabbix_agentd.service

systemctl enable zabbix_agentd.service

systemctl enable zabbix_server.service

 

访问:http://172.29.10.21/zabbix/setup.php

依次填写信息,至完成

 

zabbix图像文字乱码处理

某台机器,非本机
cd /application/nginx/html/zabbix/fonts/
scp simhei.ttf root@172.29.10.21:$(pwd)
回到本机
chown -R nginx.nginx /application/nginx/html/zabbix/fonts/simhei.ttf 
sed -i 's/DejaVuSans/simhei/g' /application/nginx/html/zabbix/include/defines.inc.php

 

 

 

安装fping

yum -y install fping
安装mailx
yum -y install mailx postfix
systemctl start postfix.service
systemctl enable postfix.service
vi /etc/mail.rc
最后部分添加
set from=za@xxx.com smtp=mail.xxx.com
set smtp-auth-user=za@xxx.com smtp-auth-password=12qwaszx!
set smtp-auth=login

测试邮件发送
echo "zabbix test mail" |mail -s "zabbix" za@xxx.com

 

安装pymssql驱动

cd /home
wget ftp://ftp.freetds.org/pub/freetds/current/freetds-current.tar.gz
tar -zxvf freetds-current.tar.gz 
cd freetds-dev.1.00.339/
./configure --prefix=/usr/local/freetds --with-tdsver=7.1 --enable-msdblib --enable-dbmfix --with-gnu-ld --enable-shared --enable-static
make && make install
vi /etc/profile
export PATH=$PATH:/usr/local/freetds/bin:/usr/local/zabbix/bin
source /etc/profile
ln -s /usr/local/freetds/lib/* /usr/lib/
ln -s /usr/local/freetds/include/* /usr/include/
ldconfig -v

yum -y install unzip
wget https://pypi.python.org/packages/e9/c3/5986db56819bd88e1a250cad2a97249211686b1b7b5d95f9ab64d403a2cb/setuptools-38.2.5.zip#md5=abfd02fba07b381c3a9682a32d765cc6
unzip setuptools-38.2.5.zip 
cd setuptools-38.2.5
python setup.py build
python setup.py install
easy_install pip
pip install pymssql

 

 

  • 大小: 6.2 KB
  • 大小: 12.6 KB
  • 大小: 22.2 KB
分享到:
评论

相关推荐

    最具实用性CentOS6.5+Zabbix2.0.6安装配置

    本文将详细讲解如何在CentOS 6.5操作系统上安装和配置Zabbix 2.0.6,帮助你实现高效的系统监控。 首先,我们了解Zabbix的核心功能。Zabbix提供了多种监控方式,如SNMP(Simple Network Management Protocol)、...

    centos7.6/7.7+zabbix4.4.7+grafana6.4.4安装指导最新版

    本文档将指导您在 CentOS 7.6/7.7 上安装 Zabbix 4.4.7 和 Grafana 6.4.4,并配置 MySQL 5.7 数据库。 环境准备 在开始安装之前,需要关闭防火墙和 SELinux,以免干扰安装过程。 安装 Zabbix 1. 首先添加 Zabbix...

    zabbix详细安装教程(linux+postgresql+nginx+zabbix)

    ### zabbix详细安装教程(linux+postgresql+nginx+zabbix) #### 环境说明与配置 本教程将指导您如何在Linux环境下安装...接下来的部分将继续介绍如何安装Nginx、Zabbix及其配置细节,以完成整个自动监控系统的部署。

    Centos7.9安装部署Zabbix6

    Centos7.9安装部署Zabbix6,需要安装包的发邮箱,文件里面包含邮箱地址

    centos6一键安装lnmp+zabbix服务端(ok脚本)

    centos6一键安装lnmp+zabbix服务端(ok脚本) install Nginx 1.8.x + mysql5.5.x + PHP-FPM 5.4.x + Zabbix 2.4.7 automatically.

    Linux8.5+Zabbix6.0+Grafana8.4.3实现数据中心运维信息的可视化展示

    Zabbix服务器将承担监控任务,需要安装在一台独立的虚拟机上,配置足够的内存和CPU资源,以便处理大量的监控数据。同时,为了保证数据安全性,需要配置合适的磁盘存储空间。 3.2 Grafana 服务器部署 Grafana服务器...

    redhat7、centos7系统,zabbix Server 离线安装包

    redhat7、centos7系统,zabbix Server 离线安装包 redhat7、centos7系统,zabbix Server 离线安装包redhat7、centos7系统,zabbix Server 离线安装包

    centos7.1+zabbix-server安装

    标题《centos7.1+zabbix-server安装》指出了本文的核心内容是介绍如何在CentOS 7.1系统上安装并配置Zabbix Server,这是一个开源的网络监控工具,广泛应用于监控IT基础设施的性能和状态。文章强调了在安装Zabbix ...

    centos下libstdc++

    centos下libstdc++库依赖问题。这里下载:http://pkgs.org/centos-6-rhel-6/centos-rhel-i386/compat-libstdc++-296-2.96-144.el6.i686.rpm/download/

    基于centos7下zabbix的搭建

    在本教程中,我们将详细介绍如何在 CentOS 7 环境下搭建 Zabbix 5.0 监控系统。Zabbix 是一款开源的企业级监控解决方案,可以用来监控网络设备、服务器性能、应用服务等。以下是详细的步骤: 一、系统环境准备 在...

    Centos7.9安装zabbix6.0LTS版

    CentOS 7.9 安装 Zabbix 6.0 LTS 版 Zabbix 是一个基于 Web 的网络监控系统,能够实时监控服务器、网络设备和应用程序的状态。下面是 CentOS 7.9 安装 Zabbix 6.0 LTS 版的详细步骤。 安装 Nginx 首先,需要安装 ...

    centos7安装+tomcat+mysql+jdk+nginx配置步骤

    centos7安装+tomcat+mysql+jdk+nginx配置步骤,按着步骤走傻子都能做出来,非常详细

    centos7 zabbix 一键安装脚本

    shell脚本完成zabbix 3.4 版本的一键安装过程,减少新手或小白的操作难度,即装即用,快速体验。

    centos上iscsi+multipath多路径存储配置手册.pdf

    "CentOS 上 iSCSI+Multi-Path 多路径存储配置手册" 本手册主要介绍了在 CentOS 操作系统上配置 iSCSI+Multi-Path 多路径存储的步骤和方法。下面是相关知识点的总结: iSCSI 协议 iSCSI(Internet Small Computer ...

    Centos 7.4 安装Zabbix 3.4

    为了确保Zabbix能够顺利地安装与运行,在CentOS 7.4系统上需要进行一些基本的环境配置。 ##### 关闭防火墙 1. **临时关闭防火墙**:通过执行`systemctl stop firewalld.service`来临时关闭防火墙。 2. **永久关闭...

    centos8安装zabbix6脚本

    总结一下,安装Zabbix 6.0在CentOS 8上涉及的关键步骤包括:准备安装脚本、解压文件、运行安装脚本、设置数据库、配置Web界面以及启动和启用服务。这个过程既可以通过在线脚本完成,也可以离线安装,具体取决于你的...

    ELK+Zabbix+TimesacleDB+Grafana.docx

    在本示例中,我们使用了 Centos 7 操作系统,4 核 8G 内存的服务器,来搭建 Zabbix 分布式监控系统。我们需要监控 18-19W 的监控项。 Zabbix 分布式搭建架构图如下: * Web server:前端页面,提供用户界面和 API...

Global site tag (gtag.js) - Google Analytics