I recently spun up a Digital Ocean “droplet” (VM) running Centos 6.5. The setup of the various WordPress components was fairly smooth, the only issue was that I was not able to update any plugins. Whenever I tried, I got the following error:
Unpacking the update… Could not create directory.
The screenshot of the actual error is below:
After some digging about on the internet I found this link. It is caused by a file ownership issue. The folder containing your WordPress data is owned by a different user than apache web server. So when tying to update a plugin or installing a new one WordPress is unable to edit or create the relevant plugin directory. The solution is to change the permissions of the WordPress folder so that apache has ownership of them.
I ran the following command to fix the problem:
chown -R apache:apache /var/www/wordpress
Run the above command changing the path to reflect the location of your wordpress site and the next attempt to update or install a new plugin should be successful:
Unpacking the update… Installing the latest version… Removing the old version of the plugin… Plugin updated successfully.
The actual screenshot of the successful update is below: