Early airborne combat was more like a drive-by shooting as pilot used handheld firearms to fire upon other aircraft. Whomever could boost firepower and accuracy would have the upper hand and so machine guns were added to planes. But it certainly wasn’t as simple as just bolting one to the chassis.
This was during World War I which spanned 1914 to 1918 and the controllable airplane had been invented a mere eleven years before. Most airplanes still used wooden frames, fabric-covered wings, and external cable bracing. The engineers became pretty inventive, even finding ways to fire bullets through the path of the wooden propeller blades while somehow not tearing them to splinters.