It seems that the Debian / Ubuntu PHP doesn't bundle the GD library with it, some security reason. You have to recompile PHP, follow this helpful step by step guide on doing so with Debian / Ubuntu: http://www.maxiwebs.co.uk/gd-bundled/compilation.php
Open up a terminal.
Become root by typing su and enter your root password when prompted.
Download some packages we'll need for the install. Type apt-get install build-essential debhelper fakeroot dpkg-dev mysql-server. When MySQL install asks for the root password, think of one, then keep it safe.
Change your current directory to your source one. cd /usr/src.
Download the PHP 5 source code by typing apt-get source php5.
We also need the PHP 5 dependencies. To download these, enter apt-get build-dep php5.
Go into the downloaded PHP directory. cd php5-XXXX. just press after you've typed php5- to complete the folder name.
Now we need to edit a config file to change it into the bundled version of GD. Type nano debian/rules.
Locate the line that says --with-gd=shared,/usr --enable-gd-native-ttf \ and change it to --with-gd=shared --enable-gd-native-ttf \ by removing ,/usr. (Press ctrl+w to find something, if you search for gd, it is near the second occurrence). To save the file, we need to press ctrl+x then press y and then enter.
Now we need to edit the MySQL setup file. Type nano debian/setup-mysql.sh. Note: If this file does not exist, don't worry, you can skip steps 10 and 11.
Find the line $mysqld > $datadir/run.log 2>&1 & and change it to $mysqld --user=root > $datadir/run.log 2>&1 & by adding --user=root to it. To save the file, we need to press ctrl+x then press y and then enter.
Now we've done setting up we now need to compile it. Type dpkg-buildpackage -rfakeroot, or if you're using Ubuntu 11.10, you should type dpkg-buildpackage -d, this will take some time.
When it's done, you should have a load of .deb files in the parent directory. Find the one starting with php5-gd.
Install it by double clicking on it, or from the terminal, type dpkg -i php5-gdXXXXXXX just press after you've typed php5-gd to complete the file name.
Now we need to stop updates from replacing your shiny new GD library with the regular non-bundled version by holding the package. Run the following command: apt-get install wajig.
Say yes to the install.
After the install, enter the following: wajig hold php5-gd.
Congratulations! You now have the bundled version of the GD Library installed, now go and be creative with it!