在Debian上進行LNMP(Linux, Nginx, MySQL/MariaDB, PHP)的版本升級,需要分別對每個組件進行升級。以下是升級步驟:
備份數據:在進行任何升級操作之前,請確保備份所有重要數據,以防萬一。
更新系統軟件包列表:
sudo apt-get update
sudo apt-get install nginx
如果需要升級到特定版本,可以使用apt-get install nginx=版本號
,例如:
sudo apt-get install nginx=1.21.6-1~buster
sudo apt-get install mysql-server
對于MariaDB:
sudo apt-get install mariadb-server
在安裝過程中,系統可能會提示你設置或更改root用戶的密碼。
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
然后,升級PHP及其相關模塊。例如,要升級到PHP 7.4:
sudo apt-get install php7.4 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
注意:以上步驟適用于Debian 10(Buster)。如果你使用的是其他版本的Debian,請根據實際情況調整軟件源和版本號。