What is involved in replacing a 5.2 with a 5.9

I am also buying a truck 5.9 (not sure on the year yet) complete engine with pullies, accessories. mounts.comp, alt, everything. Just don't know the history of it. So I should have everything I may need. Just waiting to get the tittle on it before I buy the two engines. Truck is club cab and is real nice. I also got a 2002 Dakota 4x4 quad cab 4.7 auto that is in nice shape. The other one I will get eventually is a 1996 ext cab Dakota. Bad 3.9.