Organising resistance and convincing some Expeditions on several planets to join your cause can be a challenging task. However, as long as life exists, it is worth defending.
To gain people's heart and push back the Legion invasion, there are few things that you could do.
For instance, building outposts (such as Armory or Observatory) or defeating enemy forces (especially Master Prime and Extractors) will help you to gain the influence that you need.
As described on the picture below, a certain amount of influence may be needed to build new things.