You have to grow cactus on a sand block, but biome should not matter. Diagonal blocks should not matter either (I have planted it at corners of homes, and just tested it in 1.2.3).
You do need air on its flat sides and above it as high as you want to allow it to grow up to its maximum.
and does it have to be in desert biome?
TOP VIEW
Where =air and = Cactus.
Twitter: @EvanLange7737
You do need air on its flat sides and above it as high as you want to allow it to grow up to its maximum.