In this paper, a nonlinear adaptive backstepping controller is designed to control the common DC-bus voltage for different components in a DC microgrid under various operating conditions. The DC microgrid in this paper comprises a solar photovoltaic (PV) unit, a battery energy storage system (BESS), a backup diesel generator, and loads (both critical and non-critical). The controllers are designed for all components except loads where the main control objective for all controllers is to maintain a constant voltage at the DC-bus where all components are connected. This paper considers solar PV systems as the renewable energy source (RES) whereas a diesel generator equipped with a rectifier is used as a backup supply to maintain the continuity of power supply in the case of emergency situations. The proposed controller is designed recursively based on the Lyapunov control theory where all parameters within the model of different components are considered as unknown. Adaptation laws are used to estimate these unknown parameters while the stability of the DC microgrid, with these adaptation laws, is ensured through the formulation of suitable control Lyapunov functions (CLFs) at different stages of the design process. The negative definiteness or semi-definiteness of these CLFs guarantees the stability of the DC microgrid. Finally, the performance of the proposed controllers is verified using both simulations and experiments on a test DC microgrid under different operating conditions. The proposed controller ensures the regulation of the DC-bus voltage within the acceptable limits under different operating conditions.