Each component slot on the motherboard fits a certain type of computer part spec.
Motherboards tend to support one CPU Socket Type (i.e. LGA775), so buy a CPU with the same socket type.
Motherboards tend to support a range of RAM speeds (DDR3 1333/1066), so buy RAM with that supported speed...