How to prevent metals from rusting apart from galvanising?
There are several methods. The suggestions to electroplate or paint the metal both work on the same principle, which is to keep oxygen molecules from being able to react with the metal. This is the best way to prevent rust. A variety of corrosion inhibitor coating are available, all with the aim of preventing oxygen from contacting the metal surface. These vary from paints, to waxes or oils, to coatings with other metals. In some cases, the metal may be left bare, and a controlled amount of corrosion can be allowed to build up on the exposed surfaces, which actually protects the bulk of the metal beneath.
Other options are treatment with an oxygen-scavenging chemical, which reacts with the oxygen molecules before the metal itself does. This is a common way to protect the inside surfaces of vessels like boilers and tanks. In wet locations, cathodic protection can also work; it uses a chemical like zinc oxide, which prevents the water from breaking down into oxygen and hydrogen.