Linux LVM: Reduce Filesystem and Logical Volume
March 14, 2012 – 5:07 pm | No Comment

The following example shows how to reduce the size of a filesystem mounted on an LVM logical volume. The instructions below are only for non-root filesystems. No reboot is required, but the filesystem will need to be unmounted. So, if there are any user applications using this filesystem, they will need to be stopped and the users will need to log out.

Read the full story »
Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » WordPress

WordPress Quick Upgrade for Linux

Submitted by on June 13, 2008 – 6:22 pm2 Comments
WordPress Quick Upgrade for Linux

Never ever upgrade WordPress to the latest version as soon as it comes out, unless you want to be the guinea pig dealing with the new bugs and incompatible plugins. Even if the new version of WordPress contains critical security updates, wait a couple of weeks to let others work out fixes for any new bugs and to let the plugin authors ensure compatibility.

You always need to have a test version of your WordPress site. Duplicate your database with a different name and duplicate your WordPress installation in a separate folder on the server. This will be your sandbox for testing new versions of WordPress and plugins. If the new version breaks something, it will not be your production site.

It is always a good idea to first test the upgrade on a copy of your site. To create a copy, follow these simple steps:

INSTALL_DIR=/srv/www/htdocs/wordpress
TEST_DIR=/srv/www/htdocs/wordpress_test
mkdir ${TEST_DIR}
rsync -avu ${INSTALL_DIR}/ ${TEST_DIR}/

Now you will need to connect to MySQL and create a copy of your database. This is best done from command line:

mysql -u<USERNAME> -p<PASSWORD>
CREATE DATABASE wordpress_test;
quit

Now you can use the mysqldump command to copy structure and contents from your primary database to the “wordpress_test” database you just created:

mysqldump -u<USERNAME> -p<PASSWORD wordpress | mysql -u<USERNAME> -p<PASSWORD> wordpress_test

Use MySQL to grant your database user account necessary permissions to access the new database.

Now you need to modify $TEST_DIR/wp-config.php to change the following line to name of the new database:

define('DB_NAME', 'wordpress_test');    // The name of the database

Below is the basic upgrade procedure for WordPress running on a Linux/Unix server. This process assumes that all custom content of your WordPress installation is limited to the “wp-content” directory. Even so, the first step of any upgrade process is to backup existing files and configurations. In the following example we assume that the path to your WordPress installation is “/srv/www/htdocs/wordpress”, the path to your backup directory is “/var/backups”, and the main URL of your WordPress site is “http://www.mydomain.com”. So here we go:

  1. Place your site in maintenance mode, so users can’t login and change any content.
  2. Download and install the WP-DBManager plugin. Activate the plugin.
  3. In the wp-admin interface click on “Database” -> “Backup DB” -> make sure all the settings are correct -> enable GZIP compression -> click “Backup”. This will backup your WordPress database and give you something to fall back on in case your upgrade fails.
  4. Run the following commands to download, unpack and install the new version of WordPress:
#!/bin/bash
 
INSTALL_DIR=/srv/www/htdocs/wordpress
BACKUP_DIR=/var/backups
 
cd $INSTALL_DIR
tar cvf ${BACKUP_DIR}/site_backup_`date +'%Y-%m-%d'`.tar .
gzip ${BACKUP_DIR}/site_backup_`date +'%Y-%m-%d'`.tar
wget http://wordpress.org/latest.tar.gz
tar xfz latest.tar.gz
rm -rf ./wp-includes/
rm -rf ./wp-admin/
cd ./wordpress
cp -rpf --reply=yes * ../
cd ..
rm -rf ./wordpress/
rm -f latest.tar.gz

In the browser, go to http://www.mydomain.com/wp-admin/upgrade.php and upgrade the database. And that’s all there is to upgrading your basic WordPress installation.

Popularity: 4% [?]

Related posts:

  1. Creating print.css for WordPress
  2. Improving WordPress Performance
  3. Upgrade procedure for phpBB2

2 Comments »

  • Igor says:

    As if to confirm the above warning to never rush with upgrading your WordPress to the latest and greatest release, version 2.6 just came out with a major bug. Basically, once you upgrade from 2.x to 2.6, you will not longer be able to login to the WordPress admin interface. Yeah, that may be inconvenient. There is a quick fix, though. Add the following line to your wp-config.php

    @define(‘ADMIN_COOKIE_PATH’, ‘/wp-admin’);

    This should provide you with a workaround until the WordPress team releases an official fix.

    [Reply]

  • [...] my own advice to never install latest WordPress releases as soon as they come out, I upgraded my installation to [...]

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.