1. Install Gallery 2 and Drupal (see their respective installation documents). Gallery2 should be *inside* your Drupal installation so that it's accessible by the same website. If you installed Gallery somewhere else, you can create a symlink to it from inside your Drupal folder, e.g.
cd /var/www/drupaldir ln -s /path/to/gallery2
Or you can move Gallery2. If you're going to do that, read this FAQ
Warning - Do not name your G2 directory "gallery", call it something else (e.g. "gallery2"). Calling it "gallery" will cause a conflict with the Drupal gallery.module.
2. Ensure that the "Image Block" plugin is installed and activated in Gallery2. Check it in the non-embedded Gallery. See Gallery2:Modules:imageblock and Gallery2:Download for instructions on the plugin and how to download it if it was not included with your installation.
3. Log out of G2 (non-embedded) - people have reported errors relating to sessions if this is not done.
4. Copy the gallery module to your Drupal modules/ directory.
5. Enable the gallery module in Administer > Site building > Modules (admin/build/modules) of your Drupal installation.
6. Go to Administer > Site configuration > Gallery settings (admin/settings/gallery) and configure the path to your Gallery2 installation using the install wizard provided there.
7. (optional) Enable the "Gallery Image/Grid Block" in Administer > Site building > Blocks (admin/build/block).
To get the rewrite mode (short/clean urls) working, you need to first configure and use it with the standalone Gallery2 install. Going through the install wizard of gallery module (5.x-2.x or later) automatically saves the required configuration for embedded rewrite in step 4. In case of trouble you can still configure the settings manually: For this access the "URL Rewrite" setup via the Drupal-embedded Gallery page and configure it for the embedded mode (see Embedded URL Rewrites Guide for more info). You will need to go to "Setup" and configure the "Htaccess path" and "Public path" variables under "Embedded Setup". The htaccess file must be the one of your Drupal installation. The additional rules will be added to the top of the file, Drupal's rules will not be overwritten.
Once it's working go to "Rules" tab of Gallery2's "URL Rewrite" configuration and disable all the rules except for the 'Show Item' rule and set its URL pattern to:
When you browse to http://www.drupalsite.com/gallery you should now see short URLs inside Drupal.