I prefer the air pressure version, instead of the explosive variety. Its safer, you can get better distance, and you can fine tune your ballistics by varying the air pressure.
Supplies
3 feet of sch40 1.5" pvc (you can go bigger if you want)
2.5 feet of sch40 2" pvc
1.5" brass ball valve
1.5" male and female screw adapters
1.5" to 2" adapter
2" end cap
car/bike tire valve
lots of 2-part epoxy
hacksaw
something to mix in and spread the epoxy with
Epoxy one of the 1.5" screw adapters to the barrel (the 3' segment). Set that aside to dry for the time being. Epoxy the other one to the front of the ball valve.
Take the 2" end cap and drill a hole in it. Put the air valve through the hole, and fill the surrounding area with epoxy. Make sure you don't cover the air valve, as this could cause some problems
. Set that part aside until it dries.
Epoxy the 1.5" to 2" adapter to the ball valve, then when that dries epoxy it to the 2" pvc. Hopefully, by now the end cap will be dry. Epoxy the end cap with the air valve onto the rear end of the compression chamber.
Let everything dry for at least a day. Now you're ready for some fun. To operate, close the ball valve, attach a bike pump to the air valve, and pump it up till it hits 80-90 psi. I wouldn't suggest getting much over 100 psi, because if I remember correctly, the breaking point for sch40 pvc is 150 psi. Pvc shrapnel isn't fun.
To core various fruits and vegetables, I'd suggest using either another piece of 1.5" pvc sharpened at one end to cut things, or sharpening the end of the barrel. It really depends on how you want your cannon to look.
If you built it well, it should last quite a long time. If something breaks, it's usually not difficult to make some sort of repair. Just remember-epoxy is your friend.