There are many ways to prevent rusting of Iron:
Galvanization is a process in which the Iron sheets are coated with a layer of Zinc which prevents rusting. Zinc gets oxidized more readily than Iron. So, the Iron remains protected.
Painting the Iron surface will create a barrier between the Iron and the atmosphere, which will protect the Iron from rusting.
Iron sheets can be electroplated with a metal which is more reactive than Iron, so that instead of the Iron getting oxidized, the other metal gets oxidized (because it is more reactive).