I am reading an introductory material about topological groups and the question in the tittle comes up. Due this Proposition
Proposition. A locally compact Hausdorff topological group $G$ is compact, if and only if, $\mu(G)<+\infty\qquad $ ($\mu$ is the Haar measure of $G$).
it is enough to know what are the groups $G$ for which $G/Z$, where $Z$ is the center of $G$, is a compact group. Are those groups well-known ?