To achieve a shallow DOF :
1) Use a small F number = large aperture
2) Short shooting distance from subject
3) Longer focal length
However, any decrease in DOF caused by a shorter distance is offset by an increase in DOF resulting from a longer focal length. So, for practical purposes, the DOF is about the same for the same composition if you use a longer focal length vs a shorter focal length because a longer focal length would require you to move further away to maintain the same composition.
So the key is the aperture. Use the smallest F number = largest aperture to achieve a shallower DOF.
Notwithstanding the above, even though the DOF may be the same, the picture effects are different due to the difference in angle of view which affects FOV (field of view) and the relative sizes of the background objects and how they are rendered.
The angle of view depends on the focal length used. The field of view depends on the angle of view and object distances.
The relative sizes of objects in the picture depends on their distances in terms of how many times focal length.
If they are 2 same size objects with 1 of them 90cm (i.e. 900mm) behind the other, if you use a 90mm lens, then the object behind is 10x focal length behind the front one. Therefore if you shoot the first object from about 1.8m away (20x focal length), the magnification factors for the 1st and 2nd objects would be 1/19 and1/29 and therefore the 2nd object would be about 2/3 the size of the 1st object in the picture.
If you use a 180mm lens, then you would need to shoot the first object at 3.6m away (again 20x focal length) to have the first object have the same size in the frame as earlier (using 90mm lens). Notice now that the 2nd object (90cm behind the 1st object) is now only 5x focal length (180mm lens now) behind the 1st object. The magnification factors for the 2 objects would be 1/19 and 1/24. So the 2nd object is now 4/5 size of the 1st object in the frame.
In the 2 cases above, the DOF is the same if the same F number aperture is used but the perspective is different.
All the above taken together, in all practical purposes, if you want to have a shallow DOF, either you move as close as possible or you use the longest focal length. Moving as close as possible and then achieve your composition with a short focal length will enhance the apparent distance differences between objects (because their distance apart is more in terms of focal length when a shorter focal length is used) while using a longer focal length and moving much further away to have the same composition will narrow the field of view and helps to avoid messy background. Which one to use depends on the situation/composition and what type of perspective you want to achieve.
In the midst of all these, remember to use a smaller F number aperture = larger aperture if you want to have a shallower DOF.