Seems to me like Wallabies in on to something here.
During WWII my dad's uncle was skipper on a "Nortraship" freighter doing convoys and roaming around the seas for the entire war.
The Brisk was among many things taking part in the evacuation from Dunkerque, she was the first freighter to enter the port after the battle of Oran, she was in the first convoy at the invasion of Sicilly, and also docked at Reggio during the invasion of mainland Italy to unload munitions, supplies and some 450 British troops.
The skipper said I wouldn't have done that without the moral boost of having the men from the "Merchant marine Self defence" on board.
They were facing air raids, mines and torpedoes as their main threath.
Today the danger is desperate men in fast small vessels.
As Wallabies allready suggested, machineguns would do the job.
Since the idea is to fend the raiding party off and deny them acsess to the ship, we'd have to engage them at some distance, best done by having "machinegun nests" along the railing of the ship.
Placing guns on the superstructure of a ship will leave a vast blind-zone unabling the defender to see (and engage) the raiding party once they get close enough.
The other trick is to store handgrenades and "flashbang's" along the railing and just drop them into any boat getting too close.
Those grenades should be covered by some means of support to make them float in the water, else they would sink and the effect would decrease rapidly.
And for those who think a handgrenade would punch a hole in the hull of a supertanker creating a new "Exxon Valdez", it's not possible even if you glue the grenade to the hull.
Searchlights, preferably remote operated since they represent an easy target, watercannons and teargas cannisters would also prove usefull.
As for the personel, you'd need enough people to man all the battle stations, and keep in mind that you'd have to do watches on a minimum of 3 shifts around the clock.
Any reasonably trained ex-serviceman could do that kind of duty, the need for "specialists" doesn't rise before the pirates has actually entered the ship and is on the deck, but even then the difference would be minimal.