Renewable energies are the best solutions to reduce CO2 emissions and supply reliable electricity. This study aims to find the best combination of various components considering economic, environmental, and technical factors together. The most important consideration factors are the limitation of using PV panels due to the land constraints and applying CO2 penalties where diesel generators and the grid are generating electricity. Findings show that providing electricity by hybrid systems would be useful even in the well-provided electricity regions by the grid with the least blackouts. The best combination of the proposed components, including PV, bio generator, diesel generator, batteries, and grid for the case study region where the load demand is 890 kWh/day and peak load is 167.2 kW, would be an off-grid hybrid system including PV, bio generator, diesel generator, and battery. The optimization results show an NPC (present value of the costs of investment and operation of a system over its lifetime) of $1.02 million and a COE (the average cost per capital of useful electricity produced by the system) of 0.188 $/kWh. Finally, due to the showing of the effect of different conditions on the optimization results and making the study usable for other circumstances of the case study region, some sensitivity analyses have been carried out.