How do I install GDM and any other necessary packages for it to run on the Raspbian image?
Assuming you just want to install GDM, and not an actual window manager, just run.
$ sudo apt-get install gdm
This would be strange though as GDM is a display manager. A display manager only provides the equivalent of a login prompt. In order to actually use your desktop you would need to install a window manager, such as GNOME or Xfce.
So, just in case you would like to also install a window manager then you need to do the following.
First, you need to make sure you have
aptitude. You can install these on Debian-derived systems via
$ sudo apt-get install aptitude tasksel
Now you need to install the GNOME task via
$ sudo tasksel install gnome-desktop --new-install