Why shouldn't it be safe? It's always good to have a backup just in case, but for the most part, upgrading packages through
apt is safe. I've never encountered an issue when upgrading my LEMP stack, which I've had for at least a few months now. Also, if you're upgrading for performance, you may want to switch from
MariaDB, which can be done with:
sudo apt install mariadb-server-10.0 mariadb-client-10.0
and it should detect the
MySQL databases, and import them.
MariaDB, backing up the DB is easy, just run:
sudo mysqldump dbnamehere > database.sql
and if something goes wrong during the upgrade, simply restore the database with:
sudo mysql dbnamehere < database.sql
Or, if something went incredible wrong, simply delete the DB, make a new, empty one, and then run the above command.
A few more notes:
- Please use
apt instead of
- Just run
apt update, and not
apt update nginx mysql-server php-fpm php-mysql
Also, if you're using a VPS instead of a dedicated server, VPS providers generally give you the option to create snapshots which are easy to restore to if something goes wrong.