在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,请根据实际情况调整软件源和版本号。