What is involved in replacing a 5.2 with a 5.9

I bought a few trucks recently and one is a 2000 1500 2WD with a knocking 5.2 Automatic.
A friend of mine has a new 5.9 long block still wrapped up in plastic. So my question is, what needs to be done to make it work where a 5.2 was? Mainly with the electronics. Thanks for your help.