You don't need to ready an action in order to make an opportunity attack
The Player's Handbook has this section on Opportunity Attacks (emphasis mine):
You can make an opportunity attack when a hostile creature that you can see moves out of your reach. To make the opportunity attack, you use your reaction to make one melee attack against the provoking creature. The attack occurs right before the creature leaves your reach.
The only things you need are your reaction and for the hostile creature you can see to move out of your reach, so there's no need to ready an action.
For clarity, here's the text on Readying an action (emphasis mine):
Sometimes you want to get the jump on a foe or wait for a particular circumstance before you act. To do so, you can take the Ready action on your turn, which lets you act using your reaction before the start of your next turn.
First, you decide what perceivable circumstance will trigger your reaction. Then, you choose the action you will take in response to that trigger, or you choose to move up to your speed in response to it. Examples include "If the cultist steps on the trapdoor, I'll pull the lever that opens it," and "If the goblin steps next to me, I move away."
When the trigger occurs, you can either take your reaction right after the trigger finishes or ignore the trigger.
Theoretically, you could take the Ready action to ready an attack to trigger when an opponent moves out of your reach (basically an exact imitation of the Opportunity Attack) but there's no need to do that since you always have the ability to do an Opportunity Attack (as long as you have your reaction and nothing else is preventing you, such as the opponent using the Disengage action). Feel free to use your action on whatever else you want.
You could even choose to ready a different action, and then choose from your readied action and making an opportunity attack (per this question)! Keep in mind though, that you still only have 1 reaction per round (barring specific exceptions such as the Cavalier Fighter).