Please note: this is an updated version of the guide for restoring the volume button in Ubuntu 10.04/Gnome 2, and is specifically for those using the Gnome 3 “Classic” (Fallback) desktop (though may be applicable for Gnome-Shell and Unity).
If you’ve just upgraded to 12.04 “Precise Pangolin” and found that the volume icon/button is missing from the system tray (at the far-right of the top Gnome panel), you can choose between adding the newer indicator applet, or running the old stand-alone volume button like back in Gnome 2. With the indicator applet, it will load automatically with each boot, but it doesn’t take much to get the legacy volume button to do the same.
Note: Those who’ve had to do this before in Ubuntu 10.04 through to 11.10 will have noted the package gnome-volume-control-applet no longer exists, but since it has just been renamed, all you need to do is change the command to gnome-sound-applet.
To run it for the current session, hit Alt+F2 to open the Run Application app, paste gnome-sound-applet into the text field, and click the Run button (you can also enter the command into a terminal, but the button will disappear if you close the terminal).
To get it to start automatically from the next reboot, click the cog in the top-right (in Unity) and open Startup Applications and add it as a new entry with a name like “Volume Button”. If you’re using Gnome Classic, your user menu in the top-right won’t include Startup Applications, so just run gnome-session-properties via Alt+F2 or in a terminal.
If for some reason the volume app is missing on your system, run sudo apt-get install gnome-sound-applet in the terminal.
Alt+Right-click an empty area of the panel (if you have Compiz effects enabled, then you will need to hold Alt+Super/Windows while right-clicking), choose Add to Panel, then drag Indicator Applet Complete to next to the clock in the system tray, or wherever you want to put it instead. The volume button will be restored, but as part of the Indicator Applet which also has a mail/message notifier for Evolution and messaging apps, as well as showing when other apps like Rhythmbox music player are open.