在 Ubuntu 下更新 LNMP 組件(Linux, Nginx, MySQL/MariaDB, PHP)的方法如下:
sudo apt-get update
sudo apt-get upgrade
如果你想單獨更新 Nginx、MySQL/MariaDB 或 PHP,可以使用以下命令:
sudo apt-get install nginx
sudo apt-get install mysql-server
sudo apt-get install mariadb-server
sudo apt-get install php7.4-fpm php7.4-mysql php7.4-xml php7.4-mbstring php7.4-curl php7.4-gd
請根據你的需求選擇相應的 PHP 版本和擴展。
在更新完成后,重啟相應的服務以使更改生效:
sudo systemctl restart nginx
sudo systemctl restart mysql
sudo systemctl restart mariadb
sudo systemctl restart php7.4-fpm
檢查服務狀態以確保它們已成功啟動:
sudo systemctl status nginx
sudo systemctl status mysql
sudo systemctl status mariadb
sudo systemctl status php7.4-fpm
現在,你已經成功更新了 Ubuntu 下的 LNMP 組件。請注意,根據你的實際需求,你可能需要安裝其他 PHP 擴展或調整配置文件。