day57-zabbix 4.0 版本安装

zabbix

zabbix版本的选择

9469008-dbf8a78d80da9757.png
image.png

安装zabbix 4.0

1.下载zabbix官方yum源

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

2.更新zabbix安装源

[root@zabbix-server ~]# 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=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[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=1

如果使用zabbix官方源的话可能会有点慢,清华也有相同的源,所以可以把下载连接换成清华源的下载连接

3.替换下载源为清华源

:%s#http://repo.zabbix.com#https://mirrors.tuna.tsinghua.edu.cn/zabbix#g
9469008-548e8c5e24d0b911.png

因为清华源也是同步的zabbix官方源的,路径差不多,只是比官方的多了一层zabbix目录

4.安装zabbix服务端和web端

[root@zabbix ~]# yum install zabbix-server-mysql zabbix-web-mysql -y

5.安装数据库

[root@zabbix ~]# yum install -y mariadb-server
[root@zabbix ~]# systemctl start mariadb && systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

6.对数据库进行安全初始化

[root@zabbix ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):    ##输入root密码,没有就直接回车
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] n   ##是否设置root密码
 ... skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y       ##是否删除匿名用户,删除
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y   ##是否禁止root远程登录,是的
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y  ##是否删除test库。删除
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y  ##是否更新数据库的表。是的
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

6.创建数据库和授权用于

MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';

7.导入zabbix的表到zabbix的数据库

[root@zabbix ~]# ll /usr/share/doc/zabbix-server-mysql*/create.sql.gz
-rw-r--r-- 1 root root 1311368 Jun 26 19:24 /usr/share/doc/zabbix-server-mysql-4.0.10/create.sql.gz
[root@zabbix ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password: 

8.为zabbix server/proxy 配置数据库

[root@zabbix ~]# grep '^DB' /etc/zabbix/zabbix_server.conf 
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

9.启动zabbix-server 并加入开机自启

[root@zabbix ~]# systemctl start zabbix-server.service 
[root@zabbix ~]# systemctl enable zabbix-server.service 
[root@zabbix ~]# 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      8441/mysqld         
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      7156/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      7239/master         
tcp        0      0 0.0.0.0:10051           0.0.0.0:*               LISTEN      9568/zabbix_server  
tcp6       0      0 :::22                   :::*                    LISTEN      7156/sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      7239/master         
tcp6       0      0 :::10051                :::*                    LISTEN      9568/zabbix_server  
udp        0      0 127.0.0.1:323           0.0.0.0:*                           6154/chronyd        
udp6       0      0 ::1:323                 :::*                                6154/chronyd        

10.配置zabbix-web 前端

[root@zabbix /etc/zabbix]# vim /etc/httpd/conf.d/zabbix.conf 
        php_value max_execution_time 300
        php_value memory_limit 128M
        php_value post_max_size 16M
        php_value upload_max_filesize 2M
        php_value max_input_time 300
        php_value max_input_vars 10000
        php_value always_populate_raw_post_data -1
        php_value date.timezone Asia/Shanghai

zabbix 是基于httpd开发的,httpd 是通过一个php.so的文件调取php的。所以在承受的并发上面没有nginx高。但是监控并不是很多人看。看监控的也就只有运维这些人。还有就是nginx需要单独配置,而httpd自己起动httpd自己就可以了。

11.配置好之后起的httpd

systemctl start httpd
[root@zabbix /etc/zabbix]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

然后输入ip就可以访问zabbix了 10.0.0.81/zabbix

9469008-96de04e7c3688237.png
image.png

9469008-efcb033df8e11940.png
image.png

输入创建数据库的时候设置的信息

MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
9469008-80c41f16f6c7e850.png

如果数据库填写没问题的话就会进入看到这一个页面,如果报错了的话说明数据库信息填写有误。这里可以设置一个名字。

9469008-334355df9d176071.png
image.png

最后会显示出你填写的信息

9469008-5b6e4367382f3960.png
image.png

点下一步后就安装成功了

9469008-e4d91f1d57722f0e.png
image.png

9469008-0e902aa3370fa10a.png
image.png

12。输入后台登录账户

这是官方在数据库的表里创建好的。账号Admin 密码 zabbix

9469008-45f28932fa084462.png
image.png

zabbix安装成功

9469008-b53999aa1098f214.png
image.png

zabbix配置

要想学好zabbix就先把zabbix设置成中文。zabbix本身就支持中文

9469008-e23712366e0f42d4.png
image.png
9469008-4f8e4e968bca8562.png
image.png
9469008-c5c5a8166ab2304b.png
image.png
9469008-46dbc0d8115b5d0d.png
image.png
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值