To empty your dog's anal glands, you can perform the procedure either externally or internally. Either may be a little awkward if you have never done it before and it may be a good idea to have someone with experience do it with you the first time. Also if you experience any difficulty or the discharge appears bloody, I would have your vet examine him for evidence of obstruction or infection.
I am linking a great article that goes over the technique in detail.
emptying anal glands
I hope this is helpful. Please let me know if you have any other questions.