lets try a few answers.
2) gauss canons, or defense structures in general, are only really useful when used in clusters and in combination with repair centres and maybe hangars. beware though that defenses in this game do not serve so much as a defense in itself, but rather a network to support ships stationed there. thus, with a clever ship and structure layout you can drive off a much larger force.
4) not at all. for one thing, distance to homeworld matters on the amount of resources generated. its handled by allegiance, which is the % of resources you get from full due to distance. next, for taxes ie credits, the level of planet development is important, higher levels generate more resources. and quite a lot I may add. then there is research which can either increase the population limit on certain planet types which then gives you more money or increase metal/ crystal rates. lastly, there is also logistics structures like trade ports (for credits) or refineries (for metal/ crystal) that have to be researched and can be placed throughout your little empire. there are also a few race specific ways to gain extra resources, but that's a bit too specific for now.
I'm not really getting the other questions. I think the speed bonus for multiple labs - if any - is pretty small. does not really matter though as long as you don't play on slow mode.
as for resources for tech vs military: that is really something that requires a bit of experience to decide. it is imo one of the central challenges of this game to balance the need to improve your empire and your military in various ways. I also would say that there is no real generic strategy to go for, you should try to adapt to your surroundings, that is the planets in your vicinity, the size of the map, the proximity of enemies, the race you are playing, etc. in larger, longer maps, you can risk going for cilivilan improvements ( a few at least) first, while in smaller ones, you are usually better off going straight for a few key military techs, like certain ship types and such.
so, don't despair, it will get easier and clearer as you play. if you have problems with pirates, you can try buying them off and get them to attack another player. alternatively, if you feel overwhelmed in the beginning, you can also turn them off if you want.