http://www.ikea.com/gb/en/assembly_instructions/lack-wall-shelf__AA-200208-9_pub.pdf
Although I when I bought a set at Uni (a fair few years ago) I’m sure there was a bracket you fixed to the wall with two protruding lengths of tube that aligned with blind holes in the shelf itself.
Edit. aka like this:
http://www.ikea.com/gb/en/assembly_instructions/lack-wall-shelf__AA-24442-7_pub.pdf