apt安装zabbix

下面介绍基于ubuntu18.04,使用apt在ubuntu安装zabbix 4.0.x版本。规划在10.0.0.101主机安装zabbix server,在10.0.0.104安装提供msyql服务支持zabbix server。
官网文档

一、安装zabbix server

1.1 下载deb包

# wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-3+bionic_all.deb
# sudo dpkg -i zabbix-release_4.0-3+bionic_all.deb
# sudo apt update

1.2 安装Zabbix server,Web前端,agent

# sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-agent -y

二、准备数据库

2.1 安装mysql

# apt update
# sudo apt -y install mysql-server mysql-client #或者安装mariadb-server,mariadb-client
# vim /etc/mysql/mysql.conf.d/mysqld.cnf
	bind-address	=0.0.0.0		#修改监听地址
# systemctl enable --now mysql

2.2 创建初始数据库

# mysql -uroot
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@'10.0.0.%' identified by 'magedu.zabbix';
mysql> grant all privileges on zabbix.* to zabbix@'10.0.0.%';
mysql> quit;
# systemctl restart mysql

2.3 测试数据库

# apt -y install mysql-client
# mysql -uzabbix -pmagedu.zabbix -h 10.0.0.104
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| zabbix	         |
+--------------------+
2 rows in set (0.01 sec)

2.4 初始化数据库

##导入基础数据库
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pmagedu.zabbix -h 10.0.0.104 zabbix

##在mysql主机检验发现生成很多数据库
mysql> use zabbix;
Database changed
mysql> show tables;
+----------------------------+
| Tables_in_zabbix           |
+----------------------------+
| acknowledges               |
| actions                    |
| alerts                     |
| application_discovery      |
| application_prototype      |
| application_template       |
| applications               |
| auditlog                   |
	.....#初始化成功

三、编辑zabbix server配置文件

编辑配置文件,指定zabbix的相关数据库账户密码

# vim /etc/zabbix/zabbix_server.conf
# grep -v  "^#" /etc/zabbix/zabbix_server.conf|grep DB
DBHost=10.0.0.104
DBName=zabbix
DBUser=zabbix
DBPassword=magedu.zabbix
DBPort=3306

四、解决时区问题

# vim /etc/zabbix/apache.conf
 
 	....
	php_value date.timezone Asia/shanghai

五、启动服务并访问web界面

5.1 启动服务

# systemctl restart zabbix-server zabbix-agent apache2
# systemctl enable zabbix-server zabbix-agent apache2
# ss -ntl |grep "10050"
LISTEN   0         128                 0.0.0.0:10050            0.0.0.0:*       
LISTEN   0         128                    [::]:10050               [::]:* 
  ....省略.....

5.2 访问web界面

打开浏览器范文10.0.0.101/zabbix
apt安装zabbix_第1张图片
apt安装zabbix_第2张图片
apt安装zabbix_第3张图片
apt安装zabbix_第4张图片
apt安装zabbix_第5张图片
apt安装zabbix_第6张图片
apt安装zabbix_第7张图片
由此,zabbix serve安装完成

你可能感兴趣的:(apt安装zabbix)