Go to your local big-box store (or even better, a locally owned plumbing supply place) and get a standard P-trap kit.
It will include all the pieces you need as well as instructions on how to install it.
There is plenty of adjustment available in a P-trap kit to fit almost any installation situation. You might, possibly need to shorten the tail piece from the sink, but I doubt it.
Looking at your main picture, this caught my eye:
While I get the hack job on the back panel, sometimes that's just necessary, it looks like there may have been a horizontal support rail across here that got removed and these look like the nails/staples that used to hold it on. If that's the case, you may have compromised the lateral integrity of the cabinet by removing it. If your cabinet is screwed to the wall (or another cabinet to the side), it may not matter too much, but if it's free standing, the cabinet could be subject to some racking if there was something removed from here.
Based on the added picture showing the P-trap kit installed but not fitting:
You'll need a tail-piece extension kit to lengthen the tail piece to reach the top of the P-trap itself.
You'll also need another 45° angle or two and a saw to adjust the horizontal piece to get the trap into the correct location.
At this point, your solution is all on you:
- Take some measurements of what's necessary to get the trap lined up with the sink
- Stare at the parts at the store, mentally rearranging them until they look like they'll fit.
- Grab the parts you think you'll need.
- NOTE: one of these parts you think you'll need is NOT a flexible extension. This will only cause you grief and misery because they'll fit, but they'll clog something fierce.
- Grab a few extra parts, just in case
- You might need to use another tail piece extension to extend the horizontal run
- Fiddle around with all the parts under the sink until you've got an arrangement that'll work.
- Use tape and a spare pair of hands, if necessary, to hold pieces in place while you fiddle
- Cut pieces as necessary (the tail piece extension may need to be shortened).
- If in doubt, cut long. You can always cut shorter, but making it longer involves another trip to the store.
- Install all pieces, hand tightening the slip nuts
- Check for leaks
- Do not turn slip nuts with a wrench more than about 1/8 turn to stop a leak. If you have to turn more than that, something's not right and more tightening won't solve it!
- Return all the unused parts
- Alternatively, put them in the "spare plumbing parts to be returned" basket and look at them ever 5 years or so, wondering why you didn't return them right away.