Upgrading LNMP via one-click script command line to the latest version of LNMP, MySQL, PHP, and Nginx
How to Upgrade LNMP to the Latest Version
1. Log in to the command line interface of the server.
2. Run the following command to back up the current LNMP configuration files and website data:
``` cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak cp /etc/php.ini /etc/php.ini.bak cp /etc/phpfpm.d/www.conf /etc/phpfpm.d/www.conf.bak cp -r /var/www/html/* /var/www/html_backup/ ```
Updating System Software Package List
3. Update the system software package list:
``` yum update ```
4. Install the latest version of LNMP software packages:
``` yum install -y http://lnmp.org/install.sh ```
5. Run the one-click script to install and configure LNMP:
``` yum install -y lnmp && lnmp start ```
6. Wait for the installation to complete, which may require entering some confirmation information.
7. Check if LNMP has been successfully upgraded to the latest version:
Check Nginx version: nginx -v
Check PHP version: php -v
Check MySQL version: mysql -V
8. To stop LNMP services, use the following command:
``` lnmp stop ```
9. To restart LNMP services, use the following command:
``` lnmp restart ```
10. To reload Nginx configuration, use the following command:
``` nginx -s reload ```
11. To reload PHP configuration, use the following command:
``` phpfpm reload ```
12. To reload MySQL configuration, use the following command:
``` mysql_secure_installation reconfigure ```
Upgrade MySQL, PHP, Nginx to the Latest Version (Manual Method)
1. Upgrade MySQL:
Download the latest version of the MySQL installation package.
Stop the MySQL service: systemctl stop mysqld
.
Uninstall the old version of MySQL: yum remove mysql-community-server
.
Install the latest version of MySQL: Follow the installation instructions in the package.
Start the MySQL service: systemctl start mysqld
.
Set root password and other security options.
2. Upgrade PHP:
Download the latest version of the PHP installation package.
Stop the PHP FPM service: systemctl stop php-fpm
.
Uninstall the old version of PHP: yum remove php*
.
Install the latest version of PHP: Follow the installation instructions in the package.
Start the PHP FPM service: systemctl start php-fpm
.
3. Upgrade Nginx:
Download the latest version of the Nginx installation package.
Stop the Nginx service: systemctl stop nginx
.
Uninstall the old version of Nginx: yum remove nginx
.
Install the latest version of Nginx: Follow the installation instructions in the package.
Start the Nginx service: systemctl start nginx
.
4. Check if the new version of the software is functioning correctly. You can verify by accessing a test page or running some simple PHP code. If you encounter any issues, please refer to the relevant documentation or seek help.
Thank you for reading. Feel free to leave a comment, follow for more updates, and like if you found the information helpful. Thank you for your attention.
评论留言