当前位置:网站首页>ZABBIX installation pit avoidance Guide

ZABBIX installation pit avoidance Guide

2022-06-25 03:52:00 51CTO

(1)zabbix Installation of the server of :

①zabbix Deployment process planning :

1、centos7 I won't support it yum Install server , The client can yum install



2、 Deploy ngx+php Environment and test



3、 Deploy database mariadb 10.5 And on



4、 Compilation and installation zabbix-server Server and backend configuration



5、 Deploy front-end code for access



6、web visit




② Deploy nginx+php:

1、yum -y isntall nginx

[[email protected] conf.d]# cat zabbix.conf

server {

listen 80;

server_name localhost;

access_log /var/log/nginx/she-access.log main;

error_log /var/log/nginx/she-error.log notice;

root /app/code/zbx;


# static state

location / {

index index.php;

}


# dynamic

location ~ \.php$ {

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index_php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

}


[[email protected] conf.d]#



2、[[email protected] zabbix-6.0.5]# yum install -y php72w-cli php72w-fpm php72w-gd php72w-mbstring php72w-bcmath php72w-xml php72w-ldap php72w-mysqlnd -y



3、 modify php Configuration of :

[[email protected] conf.d]# grep 'nginx' /etc/php-fpm.d/www.conf

user = nginx

group = nginx

[[email protected] conf.d]#



4、 start-up :

[[email protected] tmp]# systemctl enable php-fpm.service

[[email protected] tmp]# systemctl enable nginx

[[email protected] tmp]# systemctl start php-fpm.service

[[email protected] tmp]# systemctl start nginx



5、 test php:

[[email protected] code]# cat zbx/info.php

<?php

phpinfo();

?>

[[email protected] code]#



6、 See if the page appears , see php Whether to cooperate nginx:

 ​http://120.48.55.178/info.php​




③ Deploy database :

1、zabbix 6.0 I won't support it mariadb5.5 To install mariddb10.0 above



2、 To configure mariadb yum Source :

[[email protected] ~]# cat /etc/yum.repos.d/mariddb.repo

# MariaDB 10.5 CentOS repository list - created 2022-06-24 08:48 UTC

# https://mariadb.org/download/

[mariadb]

name = MariaDB

baseurl = https://tw1.mirror.blendbyte.net/mariadb/yum/10.5/centos7-amd64

gpgkey=https://tw1.mirror.blendbyte.net/mariadb/yum/RPM-GPG-KEY-MariaDB

gpgcheck=0


[[email protected] ~]# yum install -y MariaDB-server MariaDB-client



3、 Check for installation :

[[email protected] code]# rpm -qa |grep -i mariadb

MariaDB-common-10.5.16-1.el7.centos.x86_64

MariaDB-server-10.5.16-1.el7.centos.x86_64

MariaDB-compat-10.5.16-1.el7.centos.x86_64

MariaDB-client-10.5.16-1.el7.centos.x86_64

[[email protected] code]#



4、 start-up :

[[email protected] code]# systemctl enable mariadb

[[email protected] code]# systemctl start mariadb



5、 Database initialization :{ Only once }

[[email protected] code]# mysql_secure_installation

You already have your root account protected, so you can safely answer 'n'. < The new database has no password n>


Switch to unix_socket authentication [Y/n] n < transport n>

... skipping.


You already have your root account protected, so you can safely answer 'n'.


Change the root password? [Y/n] y < Modify a database root Password >



Remove anonymous users? [Y/n] y <y>

... Success!



Disallow root login remotely? [Y/n] y <y>

... Success!

e moving into a production environment.


Remove test database and access to it? [Y/n] y <y>



Reload privilege tables now? [Y/n] y <y>

... Success!


[[email protected] code]#



6、 Create a library :

[[email protected] code]# mysql -uroot -p

MariaDB [(none)]> create database zabbix charset utf8 collate utf8_bin;

Query OK, 1 row affected (0.000 sec)


MariaDB [(none)]> grant all on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';

Query OK, 0 rows affected (0.001 sec)


MariaDB [(none)]>



7、 Import data into the database :{ Pay attention to the import order - Don't make a mistake }

1. Download source package :https://cdn.zabbix.com/zabbix/sources/stable/6.0/zabbix-6.0.5.tar.gz



2. Import :

[[email protected] database]# cd /tmp/zabbix-6.0.5/database/mysql/

[[email protected] mysql]# ls -lh

total 33M

-rw-r--r-- 110001000 31M May 3014:23 data.sql

-rw-r--r-- 110001000282 May 3014:22 double.sql

-rw-r--r-- 1100010001.5K May 3014:22 history_pk_prepare.sql

-rw-r--r-- 1100010001.9M May 216:26 images.sql

-rw-r--r-- 110001000508 May 3014:22 Makefile.am

-rw-r--r-- 110001000 16K May 3014:22 Makefile.in

-rw-r--r-- 110001000 161K May 3014:23 schema.sql

[[email protected] mysql]#

[[email protected] mysql]# pwd

/tmp/zabbix-6.0.5/database/mysql

[[email protected] mysql]# mysql -uroot -p'mima' zabbix < schema.sql

[[email protected] mysql]# mysql -uroot -p'mima' zabbix < images.sql

[[email protected] mysql]# mysql -uroot -p'mima' zabbix < data.sql

[[email protected] mysql]# mysql -uroot -p'mima' zabbix < double.sql

[[email protected] mysql]# mysql -uroot -p'mima' zabbix < history_pk_prepare.sql




④ Compilation and installation zabbix:

1、 Installation dependency :

[[email protected] zabbix-6.0.5]# yum install -y mysql-devel pcre-devel openssl-devel zlib-devel libxml2-devel net-snmp-devel net-snmp libssh2-devel OpenIPMI-devel libevent-devel openldap-devel libcurl-devel



2、 To configure :

[[email protected] zabbix-6.0.5]# ./configure --sysconfdir=/etc/zabbix/ --enable-server --with-mysql --with-net-snmp --with-libxml2 --with-ssh2 --with-openipmi --with-zlib --with-libpthread --with-libevent --with-openssl --with-ldap --with-libcurl --with-libpcre


Prompt for successful compilation :

Configuration file: /etc/zabbix/zabbix_server.conf

External scripts: /usr/local/share/zabbix/externalscripts

Alert scripts: /usr/local/share/zabbix/alertscripts

Modules: /usr/local/lib/modules



3、 compile :

[[email protected] zabbix-6.0.5]# make install



4、 Check :

[email protected] zabbix-6.0.5]# zabbix_server --version

zabbix_server (Zabbix) 6.0.5

Revision 8da3e1f8419 30 May 2022, compilation time: Jun 24202220:31:28


Copyright (C) 2022 Zabbix SIA

License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.

This is free software: you are free to change and redistribute it according to

the license. There is NO WARRANTY, to the extent permitted by law.


This product includes software developed by the OpenSSL Project

for use in the OpenSSL Toolkit (http://www.openssl.org/).


Compiled with OpenSSL 1.0.2k-fips 26 Jan 2017

Running with OpenSSL 1.0.2k-fips 26 Jan 2017

[[email protected] zabbix-6.0.5]#




⑤ modify zabbix Configuration file for :

1、 Modify the configuration file :

[[email protected] ~]# grep -n '^[a-Z]' /etc/zabbix/zabbix_server.conf

12:ListenPort=10051

38:LogFile=/tmp/zabbix_server.log

99:DBName=zabbix

115:DBUser=zabbix

123:DBPassword=zabbix

507:Timeout=4

593:LogSlowQueries=3000

708:StatsAllowedIP=127.0.0.1

[[email protected] ~]#



2、 add to zabbix Users of :

[[email protected] ~]# useradd -s /sbin/nolging -M zabbix

[[email protected] ~]#



3、 Check zabbix:

[[email protected] ~]# ps -ef|grep zabbix

[[email protected] ~]# netstat -tulnp|grep zabbix

tcp 000.0.0.0:100510.0.0.0:* LISTEN 30417/zabbix_server

[[email protected] ~]#




⑥ to zabbix increase systemcctl Management of :

1、 Management writing :

[[email protected] ~]# cat /usr/lib/systemd/system/zabbix-server.service

[Unit]

Description=Zabbix Server with MySQL DB

After=syslog.target network.target mysqld.service


[Service]

Type=simple

ExecStart=/usr/local/sbin/zabbix_server -f

User=zabbix


[Install]

WantedBy=multi-user.target


[[email protected] ~]# systemctl daemon-reload

[[email protected] ~]#



2、 Restart the process :

[[email protected] ~]# pkill zabbix

[[email protected] ~]# ps -ef|grep zabbix

root 3130229428022:59 pts/300:00:00grep --color=auto zabbix

[[email protected] ~]# systemctl enable zabbix-server.service

Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.


[[email protected] ~]# systemctl start zabbix-server.service

[[email protected] ~]#




⑦zabbix Deployment of front-end code :

[[email protected] zabbix-6.0.5]# pwd

/root/zabbix-6.0.5

[[email protected] zabbix-6.0.5]# cp -a ui/* /app/code/zbx/

[[email protected] zabbix-6.0.5]# chown -R nginx.nginx /app/code/zbx/

[[email protected] zabbix-6.0.5]#




⑧ install zabbix:

1、 install :

 ​http://120.48.55.178/setup.php​



2、 Report errors :{ The fourth reason is that the dependency is not installed , The steps have already been completed }

zabbix Installation pit avoidance guidelines for _mysql



3、 To modify php Configuration of :

[[email protected] /]# grep -E -n '^(max_.*_time|post_max)' /etc/php.ini

368:max_execution_time = 600

378:max_input_time = 600

656:post_max_size = 80M

[[email protected] /]#

[[email protected] /]# systemctl restart nginx

[[email protected] /]# systemctl restart php-fpm.service

[[email protected] /]#



4、 To configure php Connect to database :{zabbix Connecting to the database is defined in the configuration file }

zabbix Installation pit avoidance guidelines for _php_02



5、 Give you the zabbix Give a name :

zabbix Installation pit avoidance guidelines for _nginx_03




6、 Final confirmation :




⑨ Sign in :{ Account Admin password zabbix}

 ​http://120.48.55.178/zabbix.php?action=dashboard.view​





(2) install zabbix client :

① To install a agine The client of :

1、 First install a source :

[[email protected] zabbix-6.0.5]# rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/6.0/rhel/7/x86_64/zabbix-release-6.0-1.el7.noarch.rpm



2、 Check if there is any in this source zabbix-agent2:

[[email protected] zabbix-6.0.5]# yum list|grep zabbix-agent2

zabbix-agent2.x86_64 6.0.5-1.el7 zabbix

[[email protected] zabbix-6.0.5]#



3、 install :{ Online installation } too XX slow

[[email protected] zabbix-6.0.5]# yum -y install zabbix-agent2


Replace source :

[[email protected] ~]# sed -i 's#https://repo.zabbix.com/zabbix#https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix#g' /etc/yum.repos.d/zabbix.repo



4:{ Or install offline }

[[email protected] ~]# wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/6.0/rhel/7/x86_64/zabbix-agent2-6.0.5-1.el7.x86_64.rpm --no-check-certificate


[[email protected] ~]# rpm -ivh zabbix-agent2-6.0.5-1.el7.x86_64.rpm



7、 Modify the client :{ The address is changed to that of the server ip, Now we are together, so there is no need to change }

[[email protected] ~]# grep -E '^[Server]' /etc/zabbix/zabbix_agent2.conf

Server=127.0.0.1

ServerActive=127.0.0.1

[[email protected] ~]#



8、 start-up zabbix client :

[[email protected] ~]# systemctl start zabbix-agent2.service


[[email protected] ~]# systemctl enable zabbix-agent2.service

Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent2.service to /usr/lib/systemd/system/zabbix-agent2.service.

[[email protected] ~]#



9、 Check :

[[email protected] ~]# ps -ef|grep agent2

zabbix 55561001:07 ? 00:00:00 /usr/sbin/zabbix_agent2 -c /etc/zabbix/zabbix_agent2.conf

root 557729428001:07 pts/300:00:00grep --color=auto agent2

[[email protected] ~]# netstat -tulpn|grep agent2

tcp6 00 :::10050 :::* LISTEN 5556/zabbix_agent2



10、 View results :

zabbix Installation pit avoidance guidelines for _mysql_04

原网站

版权声明
本文为[51CTO]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206250332315978.html