  (abridged) We continue the study of $\Lambda$SFDM cosmologies, which differ
from $\Lambda$CDM in that CDM is replaced by scalar field dark matter (SFDM) by
calculating the evolution of the background Universe, as well as linear
perturbations, focusing on scalar modes. We consider models with complex scalar
field with a repulsive, quartic self-interaction (SI), and models without SI,
referred to as fuzzy dark matter (FDM). To this end, we modify the Boltzmann
code CLASS, to incorporate the physics of complex SFDM which has as one of its
characteristics that its equation of state is maximally stiff in the very early
Universe, dominating then over all the other cosmic components, even over
radiation. We calculate CMB and matter power spectra as well as unconditional
Press-Schechter halo mass functions for various models, expanding previous
literature that were limited either to the background, or to a semi-analytical
approach to SFDM density perturbations neglecting the early stiff phase.
Comparing our results of each, SFDM and FDM, with real-field ultralight axion
models (ULAs) without SI, we characterize the differences between the
respective background evolution and linear structure growth. Our calculations
confirm previous results of recent literature, implying that SFDM models with
$\gtrsim$ kpc-size halo cores are disfavored, questioning their ability to
explain the small-scale problems on dwarf-galactic scales. Also we find that
the kinetic energy due to the phase of the complex field leads to marked
differences between SFDM/FDM versus ULAs. The mild falloff in the SFDM power
spectrum toward high k is similar to that of CDM but based on different
effects, namely the rapidly shrinking Jeans mass for SFDM as opposed to the
Meszaros effect for CDM. In addition, we find that the sharp cutoff in the ULA
power spectrum is also followed by a mild falloff, albeit at very small power.
