zabbix的yum安装

zabbix安装

  • 下载zabbix源码包
 - 
wget -c https://cdn.zabbix.com/stable/4.0.19/zabbix-4.0.19.tar.gz

解压下载的程序包
tar -zxvf zabbix-4.0.19.tar.gz
在tar -zxvf zabbi这里插入图片描述
进入解压包

cd zabbix-4.0.19/

安装依赖包

yum -y install gcc curl curl-devel net-snmp net-snmp-devel perl-DBI libxml2-devel libevent-devel pcre mysql-devel

*因为系统为reahat7.7未注册,修改yum源
在这里插入图片描述
卸载原本安装包

rpm -qa|grep yum

在这里插入图片描述

rpm -e yum-rhn-plugin-2.0.1-10.el7.noarch --nodeps

全部按照这种方式卸载完成
在从http://mirrors.163.com/centos/7/os/x86_64/Packages/下载相应的安装包

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/PackageKit-yum-1.1.10-1.el7.centos.x86_64.rpm

在这里插入图片描述
安装rpm包

rpm -ivh python-*
rpm -ivh yum-*

在这里插入图片描述
在/etc/yum.repos.d/下建立CentOS-Base.repo文件写入以下代码,备份原本的,如果是其他版本则把7改成相应的数字

#CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$7 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$7 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$7 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$7 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

清除缓存, yum clean all
测试下载 yum search vim
禁止提示This system is not registered

vim /etc/yum/pluginconf.d/subscription-manager.conf

在这里插入图片描述*

预编译:

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

在这里插入图片描述
编译和安装

make;make install

添加软链接

ln -s /usr/local/zabbix/sbin/zabbix_* /usr/local/sbin/

将/usr/local/zabbix/etc/zabbix_server.conf配置文件中代码设置为如下:

LogFile=/tmp/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456

cp zabbix_server启动脚本至/etc/init.d/目录,启动zabbix_server, 默认监听端口为10051

[root@zabbix zabbix-4.0.19]# pwd
/usr/src/zabbix-4.0.19
[root@zabbix zabbix-4.0.19]# cp  misc/init.d/tru64/zabbix_server  /etc/init.d/zabbix_server
[root@zabbix zabbix-4.0.19]# chmod o+x /etc/init.d/zabbix_server
[root@zabbix zabbix-4.0.19]# 

部署Zabbix-WEB、Database,LNMP(Linux+Nginx+Mariadb+PHP)
操作步骤和方法:
安装epel-release扩展源;

yum install epel-release -y

安装nginx软件包:

yum install nginx -y

安装Mariadb(数据库)、PHP、PHP-FPM环境:

yum install mariadb-server mariadb-devel php php-cli php-common php-gd php-ldap php-mbstring php-mcrypt php-mysql php-pdo php-fpm -y

在这里插入图片描述

修改nginx的配置文件
vim /etc/nginx/nginx.conf

worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    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$ {
            root           /usr/share/nginx/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }
}

检测nginx配置文件

[root@zabbix nginx]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successfu

拷贝Zabbix-WEB网站程序至Nginx发布目录

[root@zabbix zabbix-4.0.19]# \cp -a frontends/php/*  /usr/share/nginx/html/

在这里插入图片描述
启动mariadb

[root@zabbix zabbix-4.0.19]# systemctl start mariadb
[root@zabbix zabbix-4.0.19]# ps -ef|grep mysql
mysql     66902      1  0 16:11 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
mysql     67064  66902  2 16:11 ?        00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock
root      67101   2251  0 16:11 pts/0    00:00:00 grep --color=auto mysql

连接数据库,并且创建库

[root@zabbix zabbix-4.0.19]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.64-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
| zabbix             |
+--------------------+
5 rows in set (0.00 sec)

创建用户密码并且授权

MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by '123456';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

将安装包里的sql导入zabbix数据库

[root@zabbix mysql]# pwd
/usr/src/zabbix-4.0.19/database/mysql
[root@zabbix mysql]# ll
总用量 6096
-rw-r--r-- 1 1001 1001 4079668 3月  28 03:30 data.sql
-rw-r--r-- 1 1001 1001 1978341 3月  28 03:29 images.sql
-rw-r--r-- 1 root root   15409 4月  13 15:24 Makefile
-rw-r--r-- 1 1001 1001     392 3月  28 03:29 Makefile.am
-rw-r--r-- 1 1001 1001   15806 3月  28 03:30 Makefile.in
-rw-r--r-- 1 1001 1001  140265 3月  28 03:30 schema.sql
[root@zabbix mysql]# mysql -uzabbix -p123456 zabbix < schema.sql 
[root@zabbix mysql]# mysql -uzabbix -p123456 zabbix < images.sql 
[root@zabbix mysql]# mysql -uzabbix -p123456 zabbix < data.sql

增加zabbix用户组

[root@zabbix mysql]# groupadd zabbix
[root@zabbix mysql]# useradd -g zabbix zabbix

启动nginx php-fpm

root@zabbix mysql]# systemctl start nginx.service 
[root@zabbix mysql]# systemctl start php-fpm.service

前台页面登录
在这里插入图片描述
如上异常错误解决方法代码如下,安装缺失的软包,并修改php.ini对应参数的值即可

[root@zabbix mysql]# yum  install  php-mbstring  php-bcmath  php-gd  php-xml  -y
已加载插件:fastestmirror, langpacks, product-id, search-disabled-repos
Loading mirror speeds from cached hostfile
[root@zabbix mysql]# yum  install  gd  gd-devel  -y
已加载插件:fastestmirror, langpacks, product-id, search-disabled-repos
Loading mirror speeds from cached hostfile
[root@zabbix mysql]# sed   -i '/post_max_size/s/8/16/g;/max_execution_time/s/30/300//g;/max_input_time/s/60/300/g;s/\;date.timezone.*/date.timezone \= PRC/g;s/\;always_populate_raw_post_data/always_populate_raw_post_data/g'  /etc/php.ini
[root@zabbix mysql]# systemctl restart php-fpm.service 

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
启动zabbix_server

[root@zabbix init.d]# ./zabbix_server start
Zabbix server started.

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值