Kick things off by getting a wooden board and then going to work on it. Start drilling about twelve holes in board, with each hold being some three eighths of an inch deep. The board that you got should be a two inch by two inch board and the holes should be placed some half an inch from the ends, and should be two inches apart.
Now get twelve dowels and place them in each of the holes. Ideally, you should glue them into the hole in a manner so that only four inches or so of the dowel is visible and so that the rest is safely secured on the inside.
Now take the one by one inch board and screw it into the one by six inch board. Once you are done screwing them together, they should be parallel. The basic idea is that the one by one inch board will be attached to the wall, and will hold the six inch board in place.
Now find the place where you want to set up your gun rack. Now level the two by two inch board and use dowels to position it with the one by six inch shelf. The shelf that you have made should come to the bottom with the dowels being perpendicular to the walls. Now screw each piece to the wall to add stability and to ensure that it is secure.
After this is done, go ahead and place your guns in the rack just to make sure that it will hold.