Make a ship like a turret(ref. http://i1257.photobucket.com/albums/ii512/U2fanboy100/Gun_Turrets5_zps5b341f5b.jpg ), with with antimatter blocks or missiles and add a weapons comp. Add a few thruster blocks and a couple of powere gen blocks. Make sure you have no blocks under the core, just the sides and the top. Now add a turret docking module unto where you want teh turret placed, press c on it. Add a few turret docking enhancers right next to the turret docking module. Made sure they are connected and right next to each other. Experiment with the enhancer blocks to get the proper sized turret docking green box. Now get to turret core and press 0 to use docking beam, aim at the turret docking module and fire. You should be docked now. For auto-turrets add a bobby AI module for the turret. Tick the activate box and make sure it is set to TURRET. Now, about the Bobby, it is up to you if you want it to fire red(enemy) targets automatically, set it to ANY, if you want it to target the AI yourself threw ur mothership core, set it to TARGET. If you are building AI turrets for a station just tick it to ANY.
Turrets are a quitet difficult to do, I know I had quite the trouble figuring it out at first, found not much help out there in the topics, so I hope I`ve been some what helpful.