1. Stop idealizing your ex.
As perfect as you remember them to be, they weren't. Take them off of your pedestal and try to be realistic about them.
2. Do not allow yourself to fantasize about what life would be like if you were with them.
It's not likely what you are imagining is true and even if it is true, it's not helpful to torture yourself with those thoughts. They will lead to nothing productive. Change the subject in your mind if you catch yourself doing this.
3. Provide yourself with closure.
Write a letter to them, that you never send, telling them all you need to say. In that letter also say goodbye. Even if you never send this letter it can still provide closure in your mind. You can also set a chair out and pretend they are sitting in it, and say goodbye this way.
4. Do not keep things that remind you of them.
It's not helpful to look at their picture every day, wear their sweatshirt and sleep with their pillow every night. Get rid of that stuff. Start new routines. Even buy new stuff if you have to.
5. Look for good things that have happened because you are not with them.
Did you meet someone else, have a child, get a new job or some other positive thing since you broke up? Find something you value about your current life, that you can be grateful for.
6. Put hope in the future.
Take steps toward making your future more satisfying than your time was with them. Find ways to make your happiness independent of that person. You don't need them to be happy or fulfilled.