it depends, there's a couple ways to go about it.
1. Frame swap, this will work of the cab/bed configurations are the same, ex: Ex-cab, short bed > Ex-cab, short bed. Or, std.-cab, long bed > std.-cab, long bed, etc. A body swap would be basically the same thing.
2. Cut the front frame rails off just behind the engine crossmember and weld the new ones on
3. Cut the 4x2 engine cross member out and weld the 4x4 one in. They're different 2wd to 4wd.
4. Each engine has it's own unique engine bolt pattern and each transmission will only fit one type of engine. The ONLY exception is the 2.9L to the 4.0L, those will actually swap.
4b. You can get a transmission to fit whatever you're using in 4wd trim, t-cases all physically fit regardless. depending if 1350 or 1354 transfercase you will need the front driveshaft for that particular model case.
That should do it for the general outline of 4x4 swapping. Unfortunately there is little "bolt up" 4x4 conversion short of a whole frame/body swap.
Other than that, go for the gusto and do a Solid Axle Swap, which is generally accepted as actually being easier.