A multifunctional ultrahigh vacuum (UHV) system has been set up at the nuclear resonance beamline ID18 of the European Synchrotron Radiation Facility (ESRF). Thin and ultrathin films, nanoislands and -wires, multilayers, and stoichiometric oxides can be prepared by molecular beam epitaxy and characterized by low-energy electron diffraction, Auger electron spectroscopy, and reflection high-energy electron diffraction. Upon characterization the sample is transferred under UHV conditions to the chamber for experiments with the synchrotron beam. Electronic and magnetic properties, vibrational dynamics, and diffusion phenomena can be investigated by several synchrotron radiation based techniques, such as nuclear forward scattering, nuclear inelastic and quasielastic scattering, synchrotron radiation based perturbed angular correlations, and nuclear and electronic reflectivity. In addition, two portable UHV chambers serve to transfer the sample to other beamlines profiting from the available experimental techniques at the ESRF.