Yes, you need to be guilded. Then, you're going to issue a series of commands to confuse the golem's AI. Say the following:
"All guard me"
"All guard me"
"All guard me"
"All kill" (don't target anything yet)
Type "All stop" (don't hit enter)
Target yourself (i.e., complete the "all kill" command), then immediately press enter (i.e., issue the "all stop" command)
"All follow me" (or "all stay")
After a minute or two, your golem will turn grey and you'll stop damaging it. When this happens, simply say:
"All guard me"
"All stop"
"All follow me"
Another tip for keeping the golem healed is to run the spellweaving quest. Even an elf with 0 weaving has decent a chance to cast gift of renewal. Gift of renewal will heal your golem, allowing you to train indefinitely (or at least until your weapon needs repaired).
There are a variety of methods for golem training, but this is how I do it. For more info, you can look here:
http://www.uoguide.com/Melee_Training_Guide#Method_2