Keep WordPress & phpMyAdmin up-to-date with a single command

Notice: see this follow-up post for better ways of keeping WordPress & phpMyAdmin up-to-date.

Keeping up-to-date with the latest versions of commonly used web software such as WordPress and phpMyAdmin can be a bit of a drag if you would have to manually download, unzip and upload new files through FTP each time a new version is released.

But keeping WordPress and phpMyAdmin up-to-date can be as simple as logging into your server with SSH and executing just a single command. The key to this is that these software are being developed using version control software like Subversion and Git. Not only developers can take advantage of this however; you as end-user can use them as well.

First you’ll need to install Subversion and/or Git of course. On Debian (and Ubuntu presumably) you can do this by simply running the following command (as root):

aptitude install subversion git-core

Once either or both have been installed, I can simply recommend the excellent Installing/Updating WordPress with Subversion article in the case of WordPress.

For phpMyAdmin you will need to following commands from the root directory where you would want to install phpMyAdmin in:

git clone https://github.com/phpmyadmin/phpmyadmin.git
cd phpmyadmin/
git branch --track STABLE origin/STABLE
git checkout STABLE
git pull

In case of a new install don’t forget to copy “config.sample.inc.php” to “config.inc.php” and editing it where applicable (see the phpMyAdmin documentation for more info). To keep it up-to-date, then simply run the following command from the “phpmyadmin” folder  whenever a new version is released:

git pull

This command should not overwrite custom files like the configuration file.

Update April 2012: it would appear phpMyAdmin has moved to GitHub, so the URL above has been updated.

How to enable TRIM for SSDs in Debian 6.0 “Squeeze”

Modern SSDs support the TRIM command for long-term sustained performance. However for TRIM to work right, the OS (and file system) must have support for it. In the case of Linux, you’ll need kernel version 2.6.33 or newer, use ext4 as file system and also tell the kernel to use TRIM using the “discard” mount option.

By default the Debian installer tends to prefer ext3, so be sure to change this to ext4 on a fresh install. If you have already installed Debian on a SSD with ext3, you will need to convert it to ext4 – I will not cover this here.

Debian 6.0 includes kernel version 2.6.32 by default. To use a newer kernel you do not need to turn to the testing or even unstable (Wheezy) distributions; just enable the (official) Squeeze Backports by adding this line to /etc/apt/sources.list

deb http://backports.debian.org/debian-backports squeeze-backports main contrib non-free

Then run aptitude update to get the new package list. To upgrade to the latest kernel included with the backports that does support TRIM (2.6.39 at the time of writing) run:

aptitude install -t squeeze-backports linux-image-2.6-amd64

(change amd64 to i386 if you’re still running the 32-bit version of Debian)

To enable TRIM support then add the “discard” mount option to /etc/fstab: change the default “errors=remount-ro” into “errors=remount-ro,discard”. Reboot and you’re done.

Note! Do not add the “discard” option when your drive is formatted as ext3: not only will it not work, but it will prevent the OS from booting properly.