Understanding and preventing corrosion

Corrosion can pose a threat to the integrity of a pipeline. What are the prevention measure people takes for reducing the pipe line corrosion ?