The nearest golf course to Aberdeen station itself is King's Links which has its entrance slightly over a 2.5 mile walk away.
Sorry for being a pedant but both the Kings and Nigg Bay are closer than 2.5 miles of the railway station.
The starters hut, both clubs are council run and there is no need to go into the club house, for the Kings is directly behind Pittodrie and according to google maps a walk of approx 1.3 miles and Nigg Bay is 1.5 miles away.
South of King's Links is the biggest coastal golf course desert in the populated part of Eastern Scotland
South of the Kings you have Nigg Bay and then it is about 11/12 miles as the crow flies to Stonehaven and then and then 20 miles or so to Montrose so considering how close the courses are around the Dundee area you are right in saying that there isn't much links golf.
The way I play I reckon it's better I stick to the inland course anyway.

As for courses not far from railway stations just to the south of Aberdeen you have Portlethen and the golf club there is about a mile from the train station so not a great distance.