Sometimes, folder permission restrictions prevent webmasters from updating WordPress from within its dashboard… If you cannot update or upgrade WordPress from its dashboard, then you might want to do it via SSH terminal console…
When WordPress content in a directory that’s restricted, every time you wish to install or delete plugins and themes you’ll get an error…
If you can’t resolve the issues by re-adjusting the directory permissions, you may have to update / upgrade WordPress via the command line. This brief tutorial is going to show you how to do it easily.
When you’re ready to update or upgrade WordPress via SSH terminal, continue below:
Step 1: Backup WordPress database
Before making changes to your WordPress site it’s recommended that you always backup your database content. To do that, run the commands below
sudo mysql -u root -p wp_databaseName > wp_databaseName.sql
Replacing wp_databaseName with your database name.. that should create a backup of the database.. or you may want to use a backup plugins for WordPress… There are many in the plugin store.
Step 2: Backup WordPress content
You may also want to backup WordPress content. Use Rsync to copy WordPress content directory to a backup location. To do that, run the commands below.
sudo rsync -Waq /var/www/html/wp_content /path/to/backup/directory/
After backing up WordPress database and content, continue below to begin upgrading WordPress.
Step 3: Delete WordPress wp-includes and wp-admin directories
To begin upgrading, delete the existing wp-admin and wp-include directories.
sudo rm -rf /var/www/html/wp-includes sudo rm -rf /var/www/html/wp-admin
After deleting WordPress existing folders for wp-admin and wp-includes continue to downloading WordPress content.
Step 4: Download the latest WordPress content
Next, use the link below to download WordPress latest content online
cd /tmp/ && wget https://wordpress.org/latest.zip
Unzip the content
Step 5: Move WordPress latest content to the root directory
Finally, run the commands below to copy WordPress latest content to the root directory
sudo mv /tmp/wordpress/* /var/www/html/wp_content
After moving the newest content to the root directory, open your browser and browse to your host to run W0rdPress upgrade script.
The link above is use to upgrade WordPress and its database. It may take a few seconds for this process to complete, after which, your systems should be upgraded and ready to use.
This is how to Upgrade WordPress via SSH command line.
You may also like the post below:
- Upgrade Ubuntu 16.04 LTS to Ubuntu 18.04 LTS Server
- VirtualBox 5.2 on Ubuntu 16.04 LTS Server (Headless)
- How to Change / Rename Ubuntu 16.04 LTS Server Name
- Create VirtualBox Guest Machines on Ubuntu 16.04 LTS Server (Headless)
- Setup VSFTPD on Ubuntu 16.04 LTS Server with SSL/TLS Certificates
- Configure LAMP / LEMP Server Timezones on Ubuntu 16.04 LTS
- How to Setup New Sudo User on Ubuntu 16.04 LTS Servers
- How to Disable Remote Logon for Root on Ubuntu 16.04 LTS Servers
- Setup WordPress with Apache2, MariaDB, PHP 7.1 and Varnish Proxy on Ubuntu 16.04 LTS Server