Time, patience, repeat. Fence training twice a day and never let him cross anywhere except at the "gate". For the house training, if you can buy or borrow a kennel, I have found that to be the most effective way of complete house training -- not just the bathroom training.
He is a big dog, so he must always know you have full power. I would advise teaching him not to be greedy with his food. He should be fed twice a day to his needs. There shouldn't be anything left in his bowl when he is finished, nor should he be hungry. Make him sit while you dish it up and he can only approach the food when you say so. No matter how long it takes -- 1 minute, 5 minutes or 1/2 an hour. Put food in, take it out, put it in again -- so he sees and understands that it is, in the end, YOUR food, and you are only being nice to share with him.
Never let him jump up on you or anyone else. EVER. He can and will easily hurt a child, or an injured/frail adult.
I have a rotti-shepherd that I got when he was about 16 months old. He lived on a chain and didn't even know his name in his previous home. He was smart. With 15 minute dedicated training sessions twice daily he learned the basics within a month. During the rest of the day, rules were reinforced but not specifically taught. He is now 13 years old, has cataracts, is mostly deaf, can't smell much but he has NEVER been a problem. Oh -- and it's always a good idea to incorporate hand signals with your voice commands. That's often the only way our old dog now understands what we want.
I also taught our dog that when he went somewhere he wasn't supposed to I would tell him by saying "bad grass" "bad road" "bad car" -- anything but "bad dog". I wanted him to associate the "bad" with the whatever the current action or place was. Ha - I forgot, I even taught him to "go bathroom" only in the long grass! It was great. Not anymore though -- he's too old.
Good luck and be consistent and firm. 2 years old is definitely not too old to learn. He will adapt; how well depends how much security he finds at his new home.