Ubuntu映象下載:https://mirrors.aliyun.com/ubuntu-releases/20.04.6/ubuntu-20.04.6-live-server-amd64.iso
Ubuntu在vm虛擬機器安裝(如下未提及項均保持預設選項)
1、配置軟體源為阿里雲, http://mirrors.aliyun.com/ubuntu
2、配置伺服器名稱和使用者名稱密碼
3、安裝 ssh 服務,按空格鍵選擇
4、開始安裝Ubuntu
5、安裝完成後重啟
6、登入系統,用ip add檢視下系統ip地址
7、用putty工具遠端ssh登入
8、修改Ubuntu為靜態ip, sudo vim /etc/netplan/00-installer-config.yaml,清空檔案所有內容,複製下面內容進去,閘道器地址在Ubuntu中用routel檢視
# This is the network config written by 'subiquity' network: ethernets: ens33: dhcp4: no addresses: [192.168.227.100/24] optional: true gateway4: 192.168.227.2 nameservers: addresses: [192.168.227.2] version: 2
9、修改後應用配置檔案,sudo netplan apply
10、用新的ip地址ssh連線上
11、修改時區,sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
12、驗證時區,date -R
Wed, 06 Mar 2024 21:23:05 +0800
13、系統最佳化---修改檔案描述和程序數
sudo sed -i '/^# End of file/,$d' /etc/security/limits.conf sudo sh -c "cat >> /etc/security/limits.conf <<EOF # End of file root - nproc 512000 * - nproc 512000 root -nofile 512000 * - nofile 512000 EOF"
14、軟體源替換成阿里雲
sudo sed -i.bak 's/http:\/\/.*.ubuntu.com/http:\/\/mirrors.aliyun.com/g' /etc/apt/sources.list
15、更新源並重啟電腦
sudo apt update && sudo apt upgrade -y
sudo reboot
16、安裝mysql8.0
sudo bash -c "cat >/etc/apt/sources.list.d/mysql-community.list" <<EOF deb https://mirrors.tuna.tsinghua.edu.cn/mysql/apt/ubuntu bionic mysql-5.7 mysql-8.0 mysql-tools EOF sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3A79BD29 sudo apt update sudo apt install mysql-server
17、建立zabbix資料庫並建立密碼為password,建立zabbix使用者,賦予所有資料庫許可權
sudo mysql -u root -p create database zabbix character set utf8mb4 collate utf8mb4_bin; create user zabbix@'localhost' identified WITH mysql_native_password by 'password'; grant all privileges on zabbix.* to zabbix@'localhost'; quit;
18、安裝zabbix-web、zabbix-server、zabbix-agent2、zabbix-server-mysql
wget https://mirrors.aliyun.com/zabbix/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-1+ubuntu20.04_all.deb sudo dpkg -i zabbix-release_6.0-1+ubuntu20.04_all.deb sudo apt update sudo apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent2
19、安裝zabbix中文字型
sudo apt -y install language-pack-zh-hans
20、初始化zabbix資料庫
zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -u zabbix -p -h localhost zabbix
如果初始化報錯:gzip: /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz: No such file or directory
請看這篇文章:https://www.cnblogs.com/xiykj/p/18052030
21、檢查zabbix-server、zabbix-agent2、Apache2 程序是否啟動
sudo systemctl status zabbix-server.service zabbix-agent2.service apache2.service
21、檢查zabbix-server、zabbix-agent2、Apache2服務埠是否執行起來
ss -lntp | grep -E "80|10050|10051"
22、