A density functional theory (DFT) is presented for describing the distributions of small ions around an isolated infinitely long polyanionic DNA molecule in the framework of the restricted primitive model. The hard-sphere contribution to the excess Helmholtz energy functional is derived from the modified fundamental measure theory, and the electrostatic interaction is evaluated through a quadratic functional Taylor expansion. The predictions from the DFT are compared with integral equation theory (IET), the nonlinear Poisson-Boltzmann (PB) equation, and computer simulation data for the ionic density profiles, electrostatic potentials, and charge compensation functions at varieties of solution conditions. Good agreement between the DFT and computer simulations is achieved. The charge inversion phenomena of DNA are observed in a moderately concentrated solution of 2:1 and 2:2 electrolytes using the DFT, IET, and computer simulation, but can never be predicted from the PB equation. The predictions of charge inversion from the DFT prove to be more accurate than those from the IET when compared with computer simulation data. The preferential interaction coefficients from the DFT are also compared with those from the PB equation and Monte Carlo simulation, and it is shown that the DFT is superior to the PB equation.