Avoiding primaries' basically requires not flying for any significant length if time in the same direction at the same speed. Don't fly in a straight line towards your objective - zigzag up and down, left and right. Use your afterburner for a few seconda, then brake a little to change your forward speed. You don't need to deviate by huge amounts, but enough to confuse pursuing fighters or plasma turrets.
For missiles, you need to use countermeasures. You'll hear beeps when you're getting shot at, that will speed up and get closer together. The sounds are missile lock indicators - the closer together they are, the closer the missiles. When the missiles are very close, you press X to launch a countermeasure and the missiles will lock onto that instead of you. It's particularly effective if you can get the missiles behind you. To tell where they're coming from, look at the triangles on your HUD. They'll rotate around as you turn, pointing towards the missiles that are coming towards you. Try to get them pointing towards the bottom of the screen when you fire off your counter measures.