When I was in the business I would install a solid wood (pine) 1 x 3 nailer strip at the top inside of the cabinet. Make very sure you attach the backs onto the old cabinets very well, these are going to take all the weight. Then securely fasten the nailer into the cabinet, try to use screws wherever you can. If possible, I'd also glue the backs to the cabinets, better than just screws, especially if these cabinets are made of vinyl coated particle board. I also used sheet metal screws in place of wood screws, they are hardened and hold better. Use a long #12 hex washer head screw to mount the cabinet to the wall hitting all the studs you can. If the cabinet was going to support more weight than normal, I'd put a nailer under the cabinet bottom edge, the last thing you want is a loaded cabinet crashing down on everyone. We have quakes where I live.