当前位置:网站首页>Build ZABBIX on Tencent ECS

Build ZABBIX on Tencent ECS

2022-06-24 05:41:00 User 8639654

zabbix install

One 、 Introduce the main version

1.8   I began to know 
2.0  
2.2LTS  hot    
2.4
3.0 LTS
3.2  The standard version 
3.4  The standard version 
4.0 LTS
4.2  The standard version 
4.4  The standard version 
5.0 LTS

LTS: Long term support   About five years 
 The standard version : Support for seven months 

Two 、 Learning Planning

1、 Learning version

 Study 4.0 edition , because 4.0 Is one of the long supported versions , Relatively new , Enterprises often use . When you have finished learning 4.0 To 5.0 The upgrade .

2、 learning environment

 host :zabbix
ip:  10.0.0.71
 Operating system version :centos 7.6

3、 ... and 、zabbix Production environment installation

1、 To configure yum Source

1) download zabbix yum Warehouse

Method 1

rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm

yum clean all

Method 2

wget https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm

rpm -ivh zabbix-release-4.0-2.el7.noarch.rpm

yum clean all

2) modify zabbix yum Source

all gpgcheck Set to 0

[[email protected] ~]# vim /etc/yum.repos.d/zabbix.repo 
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/debuginfo/
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck=0

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=0

2、 install zabbix The server , front end , agent , database , client

[[email protected] ~]# yum install -y zabbix-server-mysql zabbix-web-mysql

[[email protected] ~]# yum install -y mariadb-server.x86_64
[[email protected] ~]# yum install zabbix-agent.x86_64 -y

3、 Start the database and set the startup self startup

[[email protected] ~]# systemctl start mariadb.service 
[[email protected] ~]# systemctl enable mariadb.service 

4、mariadb Security Configuration Wizard

[[email protected] ~]# mysql_secure_installation 
Enter current password for root (enter for none):  Database password , Just downloaded , No password by default , Directly enter 

Set root password? [Y/n]  Whether to set user password ,y Set the password 

Remove anonymous users? [Y/n]  Whether to delete anonymous users ,y

Disallow root login remotely? [Y/n]  Whether to ban root User remote login ,y

Remove test database and access to it? [Y/n]  Whether to delete the..., which can be accessed by anyone text Test library ,y

Reload privilege tables now? [Y/n]  Reload authorization table ,y

5、 Confirm deletion , Authorized success

[[email protected] ~]# mysql -p
Enter password: 

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

MariaDB [(none)]> select user,host from mysql.user;
+------+-----------+
| user | host      |
+------+-----------+
| root | 127.0.0.1 |
| root | ::1       |
| root | localhost |
+------+-----------+

6、mariadb establish zabbix library , And authorize

[[email protected] ~]# mysql -p
Enter password: 

 Building database 
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;

 to grant authorization 
MariaDB [(none)]> grant all on zabbix.* to [email protected] identified by '123456';

7、 Import initial data

1) Find the initial data location

[[email protected] ~]# rpm -ql zabbix-server-mysql |grep create.sql
/usr/share/doc/zabbix-server-mysql-4.0.29/create.sql.gz

2) Import initial data

[[email protected] ~]# zcat /usr/share/doc/zabbix-server-mysql-4.0.29/create.sql.gz | mysql -uzabbix -p123456 zabbix

 No need to look for generic commands 
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p123456 zabbix

3) Check whether the import is successful

MariaDB [(none)]> use zabbix
MariaDB [zabbix]> show tables;

 or 
[[email protected] ~]# mysql zabbix -p -e 'show tables';
Enter password:

8、 To configure zabbix server Configuration file for

 Modify the following information 
[[email protected] ~]# vim /etc/zabbix/zabbix_server.conf 
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456

9、 start-up zabbix server And add boot - up

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

10、 confirm zabbix Server started successfully

[[email protected] ~]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      2210/mysqld         
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1400/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1561/master         
tcp        0      0 0.0.0.0:10051           0.0.0.0:*               LISTEN      18523/zabbix_server 
tcp6       0      0 :::22                   :::*                    LISTEN      1400/sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      1561/master         
tcp6       0      0 :::10051                :::*                    LISTEN      18523/zabbix_server 

11、 To configure zabbix web(httpd) The configuration file

[[email protected] ~]# vim /etc/httpd/conf.d/zabbix.conf 
        php_value date.timezone Asia/Shanghai
        
 or 
[[email protected] ~]# vim /etc/php.ini 
date.timezone = Asia/Shanghai

12、 start-up httpd, And add boot - up

[[email protected] ~]# systemctl start httpd.service 
[[email protected] ~]# systemctl enable httpd.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/sys
原网站

版权声明
本文为[User 8639654]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/08/20210805190122167I.html