心心念念的树莓派4B 到货了,就是这货
一直没时间折腾,到手了才发现,其实没想好到底折腾啥,编程,智能家居,还是搞个智能小车玩玩,都没有思路,于是决定还是先把系统装上吧,毕竟没装过这种ARM处理器的板子。。。。前前后后折腾了3个晚上。。。打住,3个晚上折腾完了,不是光装了个系统😒
正题:树莓派4B 8G版 TF64GB搭建Zabbix5.2
支持树莓派的系统有很多,我选择的开源系统,因为是ARM处理器,下载镜像的时候要注意,别宣称x86或amd64的了。选arm64或armhf,我这里最终经过多册尝试,选择的是 ubuntu-20.04.1-preinstalled-server-arm64+raspi.img.xz
,因为Zabbix5.2官网目前支持的ARM处理器的就这个,可能我也是一知半解,我之前服务器上就是Centos+Zabbix很稳定,但是centos没有ARM,从最后安装完成的结果,建议不要尝试什么centos或其他的了,浪费时间,毕竟只是个平台。
给树莓派写镜像我就不说了,这里放张图提示下
- 更换阿里源:
sudo vim /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu-ports/ focal main restricted
deb http://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted
deb http://mirrors.aliyun.com/ubuntu-ports/ focal universe
deb http://mirrors.aliyun.com/ubuntu-ports/ focal-updates universe
deb http://mirrors.aliyun.com/ubuntu-ports/ focal multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ focal-updates multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted
deb http://mirrors.aliyun.com/ubuntu-ports/ focal-security universe
deb http://mirrors.aliyun.com/ubuntu-ports/ focal-security multiverse
- 安装Zabbix官方源
wget https://repo.zabbix.com/zabbix/5.2/ubuntu-arm64/pool/main/z/zabbix-release/zabbix-release_5.2-1%2Bubuntu20.04_all.deb
dpkg -i zabbix-release_5.2-1+ubuntu20.04_all.deb
- 替换Zabbix阿里源如下:
deb http://mirrors.aliyun.com/zabbix/zabbix/5.2/ubuntu-arm64/ focal main
deb-src http://mirrors.aliyun.com/zabbix/zabbix/5.2/ubuntu-arm64/ focal main
- 更新系统
sudo apt upgrade
sudo apt update
- 安装MySQL
sudo apt install mysql-server
sudo mysql_secure_installation
系统将要求您配置VALIDATE PASSWORD PLUGIN用来测试MySQL用户密码强度并提高安全性的密码:
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?
Press y|Y for Yes, any other key for No: y
密码验证策略分为三个级别:低,中和强。按下y如果你想设置的验证密码插件或任何其他键移动到下一个步骤:
There are three levels of password validation policy:
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
在下一个提示符下,将要求您设置MySQL root用户的密码:
Please set the password for root here.
New password:
Re-enter new password:
如果您设置了验证密码插件,该脚本将向您显示新密码的强度。键入y以确认密码:
Estimated strength of the password: 50
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
接下来,将要求您删除匿名用户,限制root用户对本地计算机的访问,删除测试数据库并重新加载特权表。您应该回答y所有问题。
要以root用户身份登录到MySQL服务器,请输入:
sudo mysql
mysql > ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '需要设置的数据库root账户的密码(强密码)';
mysql > FLUSH PRIVILEGES;
- 安装zabbix及其相关软件
6.1 安装zabbix及其相关软件
apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent!
6.2 设置数据库
mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'zabbix对应数据库账户的密码';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;
6.3 导入zabbix数据库表
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
6.4 修改配置文件中对应的数据库zabbix账户的密码
sudo vim /etc/zabbix/zabbix_server.conf
DBPassword=password
6.5 启动zabbix服务器并添加启动项
sudo systemctl restart zabbix-server zabbix-agent apache2
sudo systemctl enable zabbix-server zabbix-agent apache2
- 可能存在的问题:1.无法切换中文界面
sudo apt-get install locales -y
sudo dpkg-reconfigure locales
最后重启服务器就可以了,时间仓粟,写的有点不讲究,有问题请私信!