Let me expand on my comment. There are two papers that you should look at:
Iyer, Hariharan K. On solving the equation $Aut(X)=G$.
Rocky Mountain J. Math. 9 (1979), no. 4, 653–670.
The scope of this paper is when your group $G'$ is finite. The MathSciNet review gives a perfect precis:
The author considers the finite groups having a given automorphism group $H$. First he shows (Theorem 3.1) that for every finite group H there are only finitely many finite groups $G$ having $H$ as automorphism group, and he surveys the possible groups $G$ in the cases when $H$ is one of the following types of group: alternating, symmetric, dihedral, dicyclic, quasidihedral (Theorems 4.2, 4.4, 6.3 and 6.6).
The second paper you should consult does not restrict $G'$ to being finite:
Robinson, Derek J. S. Groups with prescribed automorphism group.
Proc. Edinburgh Math. Soc. (2) 25 (1982), no. 3, 217–227.
Again the MSN review tells the story:
The author treats the question of whether a given finite group is the full automorphism group of at least one group. The main theorem gives a description of all groups $G$ such that $Aut(G)$ is finite and $Aut_c(G)$, the subgroup of central automorphisms, is semisimple. Using this, he shows that for a finite simple (nonabelian) group $S$ there is a group $G$ such that $Aut(G)≅S$ if and only if one of the following is true: (a) $S=PSL(r,2)$, $r>2$, and $G$ is elementary abelian, (b) $S$ is complete, and $G\cong \hat{S}/K$ or $(\hat{S}/K)\times Z_2$, where $K$ is any subgroup of $M(S)$, the Schur multiplier of $S$, and $|M(S):K|$ is odd in the second case, (c) $S=Sz(8)$ and $G\cong\hat{S}/K$, $K<M(S)$, $|K|=2$..... For a finite group $S$ there are only finitely many finite groups G with $Aut(G)\cong S$. This is false if $G$ is infinite. For $S\cong S_4$ the author constructs uncountably many infinite nonabelian groups G with $Aut(G)\cong S_4$.
Note that the result detailing which simple groups are automorphism groups of an arbitrary group suggests that a general necessary and sufficient condition seems unlikely to exist.