首页 > 系统相关 >CentOS 7 部署zabbix 7.0 支持Kubernetes

CentOS 7 部署zabbix 7.0 支持Kubernetes

时间:2024-08-27 14:03:50浏览次数:10  
标签:CentOS Kubernetes 7.0 devel zabbix yum install mysql php

1、基础信息

系统版本: CentOS Linux release 7.6.1810 (Core) 
内核版本: 4.19.0-9.el7.ucloud.x86_64

2、开始安装

# 依赖安装
yum -y install gcc gcc-c++ unixODBC-devel httpd mysql-devel libcurl libcurl-devel libevent libevent-devel fping curl-devel libxml2  libxml2-devel snmpd net-snmp-devel net-snmp

# nginx安装
yum install -y http://nginx.org/packages/rhel/7/x86_64/RPMS/nginx-1.20.1-1.el7.ngx.x86_64.rpm

# 安装php7
#首先安装 EPEL 源
yum install epel-release -y
#安装 REMI 源:
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm  -y

# 安装php
yum -y install yum-utils

yum-config-manager --enable remi-php74

yum -y install php php-opcache

yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel

yum -y install php-mbstring

yum -y install php-json

yum -y install php-xml

yum -y install php-fedora-autoloader

yum -y install php-sodium

yum -y install php

yum -y install php-gd

yum -y install php-devel

yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel php-devel

yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel php-devel php-gd

yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel php-devel php-pdo

yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel php-devel php-pdo php-process

yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel php-devel php-pecl

yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel php-devel php-mysqlnd

yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel php-devel php-ldap

yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel php-devel php-cli

yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel php-devel php-pecl-msgpack

yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel php-devel php-pecl-msgpack php-pecl-redis5

yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel php-devel php-pecl-msgpack php-pecl-redis5 php-pear

yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel php-devel php-pecl-msgpack php-pecl-redis5 php-bcmath

yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel php-devel php-pecl-msgpack php-pecl-redis5 php-bcmath php-pecl-zip oniguruma5php

yum install -y php-fpm

# 检查
rpm -qa|grep php

#设置开机启动、运行服务:如果无法启动php就重启一下主机
sed -i 's#nobody#zabbix#g'  /etc/php-fpm.d/www.conf
systemctl restart php-fpm.service
systemctl status php-fpm.service 

# mysql 安装
#卸载自带的mariadb
yum remove mariadb mariadb-libs -y
#下载mysql5.7的repo
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
#然后进行repo的安装
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
yum clean all
yum makecache
yum install mysql-community-server -y
yum install mysql-devel -y

# 启动mysql和设置开机自启动
systemctl enable mysqld
systemctl start mysqld

#查看临时密码
grep 'temporary password' /var/log/mysqld.log

#登陆msyql
mysql -uroot -p 查看临时密码

#首先需要设置密码的验证强度等级,设置 validate_password_policy 的全局参数为 LOW 即可,
set global validate_password_policy=LOW;
set global validate_password_length=6;#修改默认密码长度

#修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'zabbix';
flush privileges;
create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by 'zabbix';
grant all privileges on zabbix.* to zabbix@localhost;
quit;


# zabbix_server安装
wget -c https://cdn.zabbix.com/zabbix/sources/stable/6.0/zabbix-6.0.13.tar.gz
tar xf zabbix-6.0.13.tar.gz
cd zabbix-6.0.13/
yum install -y net-snmp-devel
./configure --prefix=/usr/local/zabbix/zabbix-server --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc  && make && make install
#参数说明
--prefix #编译安装路径
--enable-server #启动server端
--enable-agent #启动agent端
--with-mysql #编译连接mysql相关依赖包
--with-net-snmp #启动snmp相关,用于snmp监控设备
--with-libcurl #启动curl相关
--with-libxml2 #启动xml相关
--with-unixodbc #启动odbc相关用于监控数据库
--enable-java #启动java-agent 用于监控java类

sed -i 's/# DBPassword=/DBPassword=zabbix/g' /usr/local/zabbix/zabbix-server/etc/zabbix_server.conf
sed -i 's/# DBHost=localhost/DBHost=localhost/g' /usr/local/zabbix/zabbix-server/etc/zabbix_server.conf
# 创建zabbix需要的数据
mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql
mysql -uzabbix -pzabbix zabbix < database/mysql/images.sql
mysql -uzabbix -pzabbix zabbix < database/mysql/double.sql
mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql
useradd zabbix -s /sbin/nologin

# 启动
/usr/local/zabbix/zabbix-server/sbin/zabbix_server -c /usr/local/zabbix/zabbix-server/etc/zabbix_server.conf
tail -200f /tmp/zabbix_server.log 
#检查
netstat -lntup|grep 10051
# 杀死
ps aux |grep zabbix_server |grep -v grep |awk '{print $2}'|xargs kill -9

# systemd管理zabbix_server进程
cat /usr/lib/systemd/system/zabbix_server.service
[Unit]
Description=Zabbix Server
After=syslog.target
After=network.target

[Service]
Environment="CONFFILE=/usr/local/zabbix/zabbix-server/etc/zabbix_server.conf"
EnvironmentFile=-/etc/sysconfig/zabbix_server
Type=forking
Restart=on-failure
PIDFile=/tmp/zabbix_server.pid
KillMode=control-group
ExecStart=/usr/local/zabbix/zabbix-server/sbin/zabbix_server -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
User=zabbix
Group=zabbix
 
[Install]
WantedBy=multi-user.target

### 重载
systemctl daemon-reload
### 启动zabbix
systemctl restart zabbix_server
systemctl enable zabbix_server


# nginx添加配置
cp -a /root/zabbix-6.0.13/ui /usr/share/
mv /usr/share/ui /usr/share/zabbix
cat /etc/nginx/conf.d/default.conf

server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  localhost;
        root         /usr/share/zabbix/;
        index index.php;

        location ~ .*\.php$ {
        fastcgi_read_timeout 300;
        include fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
    }
# 启动nginx php 加入开机自启
nginx -t
nginx
nginx -s reload
systemctl enable nginx
systemctl enable php-fpm.service
systemctl restart php-fpm.service



 # 访问

http://192.168.1.1/setup.php

标签:CentOS,Kubernetes,7.0,devel,zabbix,yum,install,mysql,php
From: https://www.cnblogs.com/suyj/p/18382592

相关文章

  • Docker在CentOS上的安装
    一、yum方式安装更新软件包索引:sudoyumcheck-update安装所需的软件包,以支持通过HTTPS使用Docker仓库:sudoyuminstall-yyum-utilsdevice-mapper-persistent-datalvm2添加Docker的官方YUM仓库:sudoyum-config-manager--add-repohttps://download./linux/cent......
  • 【Kubernetes安装】WSL2+ubuntu22.04+K8s+minikube最新安装教程
    系列综述:......
  • Kubernetes API资源规范
    1.资源类型和资源对象1.1资源类型(ResourceTypes)1.1.1核心资源类型KubernetesAPIPrimitive用于描述在Kubernetes上运行应用程序的基本组件,即俗称的Kubernetes对象(Object)它们持久存储于APIServer上,用于描述集群的状态依据资源的主要功能作为分类标准,Kubernetes......
  • centos9(linux): 安装clamav
    一,官方网站https://www.clamav.net/如图:二,安装1,开启epel仓库[root@blog~]#yuminstall-yepel-release2,安装clamav[root@blog~]#yuminstallclamav说明:病毒库数据较大,200多M,安装时需要等待较长时间安装完成后查看clamav的版本:[root@blog~]#clamscan-VCla......
  • kubernetes版本回滚
    1.创建待测试的Deployment。echo"---#DeploymentapiVersion:apps/v1kind:Deploymentmetadata: name:rollback-test labels:  app:rollback-testspec: replicas:1 selector:  matchLabels:   app:rollback-test template:  ......
  • 【K8s】专题十二(3):Kubernetes 存储之 PersistentVolumeClaim
    本文内容均来自个人笔记并重新梳理,如有错误欢迎指正!如果对您有帮助,烦请点赞、关注、转发、订阅专栏!专栏订阅入口Linux专栏 | Docker专栏 | Kubernetes专栏往期精彩文章【Docker】(全网首发)KylinV10下MySQL容器内存占用异常的解决方法【Docker】(全网首发)Kyli......
  • Linux环境下的Mysql数据库入门-基于Centos系统
    关系型数据库:oracle===》收钱,大型的公司msyql===》开源的免费的sqlserver===>微软非关系型数据库:hbase===>大数据‘Redismangdb下载mysql:yuminstallmysqlyuminstallmysql-serverrpm-qa|grep-imysql===》查看数据库有没有安装好servicemysqld......
  • Redis入门篇 - CentOS 7下载、安装Redis实操演示
    文章记录了在CentOS7上,通过源码的形式,下载安装Redis的操作过程进入要安装Redis的目录cd/usr/local下载源码压缩包wgethttps://download.redis.io/redis-stable.tar.gz#不同版本可能地址不同下载完成后,使用ll命令检查,可以看到下载的压缩包:下载完成后,解压......
  • Centos7(最小化安装)系统源代码安装mysql5.7.44版本
    官网下载mysql源代码安装包步骤(旧档案-版本下载方式)-CSDN博客下载cmake操作步骤-CSDN博客下载ncurses操作步骤-CSDN博客下载bison操作步骤-CSDN博客下载boost操作步骤-CSDN博客安装之前由于是最小化安装centos7安装一些开发环境和工具包文章使用国内阿里源cd/etc/yum.r......
  • centos 配置nginx
    1.检查系统版本,安装nginxcat/etc/redhat-release,//这个命令会显示你的CentOS发行版名称以及大致的版本号rpm-qCentOS-release,//这将返回当前安装的CentOS版本的具体编号uname-r,//内核的完整版本字符串。2.安装nginxsudoyuminstallepel-release-y#如果还没有安......