I built our pantry by covering a wall with vertical library shelving rails a foot apart and using brackets that clip into rail slots at about a pitch of an inch.

I used 6", 9", 12" and 18" wide white veneered chipboard and their matching brackets, all 1/2" thick and 36" long.

This all allowed me to put the shelves exactly where I wanted and to mix and match heights and widths to match the items on them and allow accessibility.

They have been up now some twelve years with zero problems.