Ubuntu 安装 zabbix (nginx版本)

环境

Ubuntu 18.04 安装的 zabbix 版本为 5.0,下载步骤 按照 zabbix 官网的教程,也可以根据不同的环境进行切换

安装 zabbix

安装源

[root@Ubuntu:~]# wget https://repo.zabbix.com/zabbix/4.5/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.5-1+bionic_all.deb
--2020-03-04 17:30:54--  https://repo.zabbix.com/zabbix/4.5/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.5-1+bionic_all.deb
Resolving repo.zabbix.com (repo.zabbix.com)... 162.243.159.138, 2604:a880:1:20::b82:1001
Connecting to repo.zabbix.com (repo.zabbix.com)|162.243.159.138|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4136 (4.0K) [application/octet-stream]
Saving to: ‘zabbix-release_4.5-1+bionic_all.deb’

zabbix-release_4.5-1+bio 100%[==================================>]   4.04K  --.-KB/s    in 0s      

2020-03-04 17:30:55 (409 MB/s) - ‘zabbix-release_4.5-1+bionic_all.deb’ saved [4136/4136]

[root@Ubuntu:~]# dpkg -i zabbix-release_4.5-1+bionic_all.deb 
Selecting previously unselected package zabbix-release.
(Reading database ... 140455 files and directories currently installed.)
Preparing to unpack zabbix-release_4.5-1+bionic_all.deb ...
Unpacking zabbix-release (1:4.5-1+bionic) ...
Setting up zabbix-release (1:4.5-1+bionic) ...

[root@Ubuntu:~]# apt update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:2 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease [20.8 kB]
...
Fetched 7,525 kB in 3s (2,359 kB/s)                     
Reading package lists... Done
Building dependency tree       
Reading state information... Done
27 packages can be upgraded. Run 'apt list --upgradable' to see them.

安装zabbix server,前端,代理

[root@Ubuntu:~]# apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-agent
Reading package lists... Done
Building dependency tree       
Reading state information... Done
...

创建数据库、授权等

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

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> quit;
Bye

导入数据库表结构

[root@Ubuntu:/]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password: 

配置zabbix

改DB配置

[root@Ubuntu:/]# vim /etc/zabbix/zabbix_server.conf 

DBPassword 改成 DBPassword=password

配置zabbix前端

[root@Ubuntu:/]# vim /etc/zabbix/nginx.conf 

server_name 和 端口号相关的改成自己想要的配置

启动Zabbix server和agent进程

启动Zabbix server和agent进程,并为它们设置开机自启:

[root@Ubuntu:/]# systemctl restart zabbix-server zabbix-agent nginx php7.2-fpm
[root@Ubuntu:/]# systemctl enable zabbix-server zabbix-agent nginx php7.2-fpm
Synchronizing state of zabbix-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable zabbix-server
Synchronizing state of zabbix-agent.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable zabbix-agent
Synchronizing state of nginx.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nginx
Synchronizing state of php7.2-fpm.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable php7.2-fpm

测试访问

打开网站

根据以下教程一步一步检查设置等信息进行相对应的调整
https://www.zabbix.com/documentation/5.0/manual/installation/install#installing_frontend

最后systemctl enable zabbix-server和agent,zabbix-server可能需要重启机器才能启动

/* 在途中遇到很多错误排查,后续会更新出来

参考

Responses
  1. You could definitely see your skills within the article you write. The world hopes for more passionate writers like you who are not afraid to say how they believe. All the time follow your heart.

    Reply
  2. I was curious if you ever considered changing the layout of your site? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or 2 pictures. Maybe you could space it out better?

    Reply
  3. AV女优发牌 在线博彩 在线博彩

    Reply
  4. Actually no matter if someone doesn't be aware of then its up to other people that they will help, so here it happens.

    Reply
  5. What's up, its pleasant paragraph on the topic of media print, we all be aware of media is a great source of facts.

    Reply
  6. It's going to be ending of mine day, but before finish I am reading this enormous post to increase my knowledge.

    Reply