Measure the cabinet space. The finished piece should easily fit inside with the cupboard door closed, and the spices shouldn't touch the top, so subtract a few inches from the height measurement. Assuming you have a 24-inch high cupboard, for example, you could safely use 22-inch plywood for the spice rack frame.
Design your spice rack first, starting with the shelves. Depending on the amount of spices you need to store, you could have one, two or more shelves. In this example, you'll use a cabinet 24-inches tall and deep, and 8 inches wide.
Create an 18-by-8-inch rectangle from four pieces of hard wood, using nails or wood screws. Use two pieces 8 inches long, 3 inches wide and 1/2 inch thick, as well as two 18 inches long, 3 inches wide and 1/2 inch thick.
Repeat the rectangle design for each shelf, if you have more than one. Keep in mind you only have 22 inches to work with, so three shelves is probably your limit. Use more nails to connect an 18-by-8-inch piece of plywood to the wood rectangles, to form a bottom.
Attach two 22-by-8-inch pieces of plywood to each 8-inch side of the constructed wood shelves, using wood screws. Your top shelf should be flush with the top of the plywood, and your bottom shelf should reach the bottom. If you have a third shelf, center the shelf so that it won't contend for space with the others.
Sand the structure down carefully, to get rid of any splinters or rough edges. You might want to add a few coats of varnish or stain to enhance the appearance and durability.
Install two floor-mounted drawer slides with included screws into the bottom of your cupboard, exactly 8 inches apart. This is the mechanism on which your finished rack will be attached, to enable it to slide freely.
Screw in corresponding slides into the long sides on the bottom shelf of your rack, and slide the rack carefully until the side slides catch onto the floor-mounted slides.