This post is part of our WordPress series in which we show you how to install and manage WordPress blogs or websites.

To read our previous post in this series, please click here.

This post is going to show you how to upgrade WordPress to the latest version when it becomes available from the command line or console. About every six months a new version of WordPress is released, and if permissions are not set correctly on WordPress’ files or is hardened for security reasons, you may not be able to upgrade automatically from WordPress’ admin site. Upgrading automatically from within WordPress is easy, but it requires that permissions be changed on files and folders so that either apache or a FTP user is able to perform the upgrade.

This tutorial will skip though that and lets you upgrade your site from the command console via SSH manually.

Objectives:

  • Upgrade WordPress to the latest version in Ubuntu
  • Enjoy!

To get started, press Ctrl – Alt – T on your keyboard to open the terminal. When it opens, run the commands below to download the latest version of WordPress.

wget http://wordpress.org/latest.tar.gz

 

upgrade_wordpress_1

 

Next, run the commands below to extract the downloaded file.

tar -xvzf latest.tar.gz

 

upgrade_wordpress_2

 

After that, run the commands below to delete / remove WordPress’ wp-content folder from the extracted folder. The wp-content folder contains all your site’s content (images, themes, plugins). We don’t want to accidentally alter or overwrite the current one installed on your live blog. So delete this folder from the new content before continuing.

rm -rf wordpress/wp-content/

 

upgrade_wordpress_3

 

Finally, run the commands below to overwrite WordPress’ older files with the new ones.

sudo cp -rf wordpress/* /var/www/wordpress_site/

 

upgrade_wordpress_4

 

Restart apache2 by running the commands below.

 

sudo apache2 service restart

 

Go to WordPress admin site and you’ll be prompted to upgrade your database.

 

upgrade_wordpress

 

Do it and your site will be updated.

 

Enjoy!

Frequently Asked Questions

How to upgrade Wordpress CMS in Ubuntu 12.04 manually via SSH?

To upgrade Wordpress in Ubuntu 12.04 manually via SSH, you can download the latest version of Wordpress, extract the files, delete the wp-content folder, and overwrite the older files with the new ones using terminal commands.

What permissions need to be set for upgrading Wordpress files in Ubuntu 12.04?

For upgrading Wordpress files in Ubuntu 12.04, ensure that correct permissions are set on files and folders so that apache or an FTP user can perform the upgrade. Incorrect permissions may prevent automatic upgrades from Wordpress' admin site.

Why might Wordpress upgrades fail in Ubuntu 12.04 due to file permissions?

Wordpress upgrades may fail in Ubuntu 12.04 due to file permissions if they are not set correctly or if the files are hardened for security reasons. This can hinder automatic upgrades from the Wordpress admin site.

What are the steps to download the latest version of Wordpress in Ubuntu 12.04?

To download the latest version of Wordpress in Ubuntu 12.04, use the wget command followed by the Wordpress download link. After downloading, use the tar command to extract the files.

How to avoid accidentally altering Wordpress' wp-content folder during upgrade in Ubuntu 12.04?

To avoid accidentally altering Wordpress' wp-content folder during upgrade in Ubuntu 12.04, delete the wp-content folder from the extracted files before overwriting the older files with the new ones.

What is the purpose of deleting the wp-content folder during the Wordpress upgrade process in Ubuntu 12.04?

Deleting the wp-content folder during the Wordpress upgrade process in Ubuntu 12.04 ensures that you do not accidentally alter or overwrite the current content (images, themes, plugins) on your live blog.

How to overwrite Wordpress' older files with the new ones in Ubuntu 12.04?

To overwrite Wordpress' older files with the new ones in Ubuntu 12.04, use the sudo cp command followed by the path to the new Wordpress files and the destination folder where Wordpress is installed.

What is the final step to complete the Wordpress upgrade in Ubuntu 12.04?

The final step to complete the Wordpress upgrade in Ubuntu 12.04 is to restart apache2 by running the sudo apache2 service restart command in the terminal.