After installing Lightroom on a new PC I find that the XMP file are not saved next to the RAW file, or anywhere else. How to define in Lightroom to save the XMP files.
Were the changes saved in the file itself?
The changes are saved in the catalog for raw files and are applied on export.
Go to Preferences (General tab) and click the catalog settings button. In catalog settings (Metadata tab) you can choose to automatically save to XMP which will be in addition to the catalog.
Great. Can I create the XMP's for the files I recently processed?
Yes it can be done manually. For proprietary raw files you can select files in the Library grid and from the menu choose:
Metadata >> Save Metadata to Files
Or use Ctrl+S / Cmd+S
For Adobe raw (DNG) there is no sidecar file; the XMP text file is saved into the DNG file header itself.
The main reason for XMP sidecars is to keep things compatible between Adobe applications e.g. if working in Lightroom, Photoshop and Bridge. Some users like to have the XMP files as part of a backup strategy.