The first step is to purify the ore
(a) Bayer process (It iron oxide is present as a major impurity)
NaOH is added ro the ore, and as Al is amphoteric, it dissolves forming sodium aluminate, Fe2O3, remains undissolved and is removed by filteration.
Al2O32H2O + 2NaOH → 2NaAlO2 + 3H2O
Al(OH)3 is precipitated from the strongly alcaline aluminate solution by bubbline CO2, or by seeding the solution with Al2O3
NaAlO2 + 2H2O → NaOH + Al(OH)3
The Al(OH)3 precipitate is calcined which converts it to purified Al2O3

Al2O3 is melted with cryolite Na3[AlF3], and electrolysed in a graphite lined steel tank which serves as the cathode, the anode are also made of graphite.
Cryolite improve the electrical conductivity of the cell as Al2O3 is a poor conductor. In addition, the cryolite serves as an added impurity and lowers the melting point of the mixture to about 950°C various products are formed at the anodes including O2, CO2, F2 and carbon compounds of flurine.
At cathode Al+3 + 3e- → Al(molten)
At anode 60-2 → 3O2 + 12e-
O2 + C(anode) → CO2
These side products erode the anodes, which must be replaced periodically.