It would be brutally difficult
So the difficulty is the sheer magnitude of how much energy the sun applies to the Earth. It's an astonishing 1–1.5kW/m2! More energy hits the roof of your house every day than it would take to power your entire neighborhood if fully harnessed (solar cells aren't quite that awesome yet).
I turn to my favorite chart in the world, Wikipedia's comparison of energy levels by orders of magnitude:
- $3.9×10^{22} \text{J}$ - estimated energy contained in the world's fossil fuel reserves as of 2010
- $2.2×10^{23} \text{J}$ - total global uranium-238 resources using fast reactor technology
- $5.5×10^{24}\text{J}$ - total energy from the Sun that strikes the face of the Earth each year
While this isn't the end of the story, this should point out an important reality: The entire fossil fuel and fission energy reserves of the Earth account for roughly a month's energy from the Sun. Something is going to have to give.
Truth be told, we don't need the energy from the Sun. We can be more efficient if we explore extreme technological solutions. However, nature is rather dependent on this abundant energy source. Any solution we come up with is going to have to be purely synthetic, with little to no help from nature.
Extreme cheating
- $5.4×10^{41}\text{J}$ - theoretical total mass-energy of the Earth
Okay, look. If we go to the ultimate in extreme tech, and manage to convert mass directly into energy, we're pretty unaffected. Even the fusion of the sun cannot match the efficiency we would get here. Just Uzbekistan's share of the planet would be enough to keep us going for a long time ($448 978 \text{km}^2$ = 0.088% of the surface of earth = $4.7×10^{38}\text{J}$ = 86,000,000,000,000 years worth of sunlight energy). In fact, we'd probably immediately send interplanetary dumptrucks to the dead sun to harvest its hydrogen and helium for energy!
Less cheating
If we could do fusion ourselves, rather than relying on the sun, the Deuterium in the ocean contains $1.5×10^{31}\text{J}$ of energy. That's just over 2.7 million years of energy. Of course, like the extreme cheating case, we'd probably eventually send dumptrucks to harvest unfused hydrogen from the sun. It just wouldn't be quite as extremely efficient as if we had perfect matter conversion.
Even less cheating
- $3.8×10^{28}\text{J}$ - kinetic energy of the Moon in its orbit around the Earth (counting only its velocity relative to the Earth)
If we were to build a giant space generator with massive electromagnets on the moon, we could slowly bleed off its kinetic energy, giving us just shy of 7000 years worth of sunlight's energy.
Not so much cheating
Bollocks.
Okay, so what if we can't get huge amounts of energy to work with? What can we do?
The biggest issue is going to be heat generation. Humans really don't function well in ultra-cold settings, and neither do our food sources. As a lower threshold, let's target freezing. Any colder than that, and hydroponics becomes difficult (we're going to become herbivores really quickly).
Earth is going to become a frigid ball very quickly. We're going to need to effectively create a solar blanket to keep from radiating ourselves into a cold hell. Doing this with an atmosphere as chaotic as Earth's will be hard; we'll probably have to take a jaunt to the moon, where we could create an atmosphere within a solar-blanket envelope. Done right, with several layers, and we might be able to avoid freezing.
Now for our energy needs. The average terrestrial human in 2008 uses $7.7×10^{13}\text{J}$, plus $3×10^{6}\text{J}$ worth of calories. Even with inefficiencies, the calorie intake is of minimal importance. However, the cost of getting fuel is going to be going up. The oceans will freeze, so we can't do underwater drilling. We're going to be dependent on the energy sources we can find (and can send up to the moon, where we stand a chance of not freezing to death).
In all, its a miserable existence, waiting to slowly freeze. We'd probably make it, because humans are extremely resilient. However, the cost of all the depression counseling will be sky high!