The best way is to get some angle iron and mount on the side of the door where the hinges were, Then measure our where your studs in the wall are, attach angle to where it will make the door centered on those studs, and then attach the angle to the studs.
Make sure to paint the angle before attaching it to anything.
Another easy thing to do is just drill and screw it to the wall, but you have to be careful where you drill and screw, usually you are safe if you stay within an inch and a half of the sides. Then countersink the screw, putty and paint over them.