This post shows steps for students and new users to upgrade WordPress via the SSH terminal console.
When running a WordPress website, one task you’ll have to learn quickly is upgrading or updating WordPress content.
If lucky, you may have a WordPress website that automatically updates when new versions are released. If that’s the case, then you should be all set. Nothing to do but sit and relax.
However, not all WordPress websites are configured to upgrade automatically when new versions are released. If your WordPress site is configured and can not self-update, you may have to update from the server console or use other means.
An easy way to update WordPress content is from the server terminal. One can get to the server console via SSH or directly. Once on the terminal console, you can easily upgrade WordPress.
When you’re ready to update or upgrade WordPress via SSH terminal, continue below:
How to backup WordPress database
Before making changes to your WordPress site, it is recommended that you always back up your database content. If you’re running MySQL or MariaDB database server, the commands below are how to back up a database.
sudo mysqldump -u root -p wp_database > wp_database.sql
Replace wp_database with the WordPress database that you want to back up. If you have a plugin that can backup WordPress content, then use it to backup WordPress before continuing below.
How to backup WordPress content
You may also want to back up WordPress content. Assuming WordPress is installed in the /var/www/wordpress, use Rsync to copy the WordPress content directory to a backup location.
To do that, run the commands below.
sudo rsync -Waq /var/www/wordpress /path/to/backup/directory/
After backing up the WordPress database and content, continue below to begin upgrading WordPress.
Delete WordPress wp-includes and wp-admin folders.
To begin upgrading, delete the existing wp-admin and wp-include directories.
sudo rm -rf /var/www/wordpress/wp-includes sudo rm -rf /var/www/wordpress/wp-admin
After deleting WordPress’s existing folders for wp-admin and wp-includes folders, download WordPress-updated content.
How to Download WordPress content
To download the latest WordPress content, run the commands below. Once the content is downloaded, the following command extracts it.
cd /tmp/ && wget https://wordpress.org/latest.zip
Unzip the downloaded content using the commands below.
unzip latest.zip
Replace WordPress content with the latest
Finally, run the commands below to copy WordPress’s latest content to the root directory. Doing this will replace the wp-includes and wp-admin folders and overwrite any other folders with newer versions.
sudo mv /tmp/wordpress/* /var/www/wordpress
After copying the files, open your browser and browse the WordPress URL for the site to initiate the upgrade.
http://www.example.com/wp-admin/upgrade.php
Replace www.example.com in the URL with your domain.
After a brief moment, your WordPress site should be updated with the latest files. You can then log in to see the changes.
That’s it!
Conclusion:
This post showed you how to upgrade WordPress. Please use the comment form below if you find any errors above or have something to add.
Leave a Reply Cancel reply