In a more general sense, Autotrophs (things that make their own energy, like plants and many microbes) need a few things to survive: a liquid solvent, an energy source, and certain chemicals to build their bodies and metabolism out of.
Solvents are basically "Liquids That Can Dissolve/Move Other Chemicals". These liquids let organic and pre-organic chemicals swim around and recombine, instead of just reacting and settling somewhere as a mineral. The most popular chemical solvent on Earth is Water, which comes in a lot of varieties, from frigid to scalding hot, and from fresh to salty, oily, acidic, or so on. Water has traits that make it a really great solvent, but it needs a certain range of temperature and pressure to stay liquid. Too much pressure or too little temperature, and water becomes solid Ice. Too much temperature and not enough pressure, and water becomes a permanent part of the atmosphere. The worst part is that Water doesn't actually form on Telluric Planets (like Earth). All of the water we started out with reacted with metals like iron to form mineral oxides (rust) during planet accretion (we know this because there was enough unreacted Iron leftover to form our planet's core, and can observe the results on rusty old Mars). It's currently believed that all the water Mercury, Venus, Earth, Luna, and Mars have was delivered by icy comets from beyond the Frost Line, flung inward by the Gas Giants.
Also, Water is a byproduct of the Sol system having an Oxygen-heavy star. When born, a new star flings out a big disc of chemicals (Hydrogen, Oxygen, Carbon, Nitrogen, Silicon, Metals, etc) that form into rings, and eventually planets, moons, asteroids, and so on. There's a rough divide (about where our star's Asteroid Belt is) called the Frost Line. Unlike metals and minerals, lighter elements, like Hydrogen and Helium blow out past the Frost Line, where they gather and form icy comets, planets, and Gas Giants. Oxygen Stars (stars like ours, which released more Oxygen than Carbon) tend to produce a lot of Silicate-Metal minerals, Water, and some CO2 in their Protoplanetary Disc, with relatively little Hydrocarbons and Carbide-Metal minerals. Around a Carbon Star (which releases more Carbon than Oxygen) we instead would see a lot of Carbide-Metal minerals, Methane, Carbon Monoxide, and other Hydrocarbons coalescing to form the planets, with relatively little water. Thus, the inner worlds would be seeded mostly with frozen Hydrocarbon Comets instead of Water, creating seas of Ammonia, Methanol, and so on.
This isn't all bad, though! Methanol would work as a solvent for a different sort of metabolism than ours, based around Methane, Ammonia, and Carbon. You would need colder planets or lower pressure for this sort of life to work efficiently and comfortably (settled around a neat -100°C to 50°C at roughly Earth's gravity/pressure)... and, of course, Oxygen and Water would be toxic or disruptive to this ecosystem, much the same way flooding our world with Methane and Ammonia would be bad news to us. There are other forms of alternate biochemistry like Metal-Sulfur based life being studied as well, and no doubt there could be more exotic self-sustaining chemical reactions that could behave in a lifelike way too. It starts getting tough to imagine after a while, since chemicals behave in very different ways under different conditions, and we only really know about the conditions on Earth. And really, we still have a lot to figure out about the laws that create our universe's physics as well.
Anyway, in addition to a Solvent and some kind of Biochemistry, you also need an Energy Source. Earth Autotrophs get energy from a number of sources; the most common being Photosynthesis. Early seafloor microbes got their solar energy from cyan-green light which penetrated the ocean well, using a purple pigment called Rhodopsin (we still use a form of this in our eyes for night-vision!). Before migrating to land, early Plant-ancestors scavenged the purple and red light that was reflected and left over using green chlorophyll pigments. Other lifeforms, such as the
fungus found growing inside a derelict Chernobyl reactor, appear to derive energy from Radioactive particles breaking down Melanin (the same pigment that makes human skin darker) in a sort of biological fission powerplant. Still other organisms derive their energy from chemicals, such as lithotrophic microbes that subsist of minerals alone, or microbes living around sulfur vents on the sea floor. Hell, in the time since we started making synthetic fabrics,
microbial life has even evolved to eat Nylon. Where an energy source exists, something will try to fill it... and more exotic life could get its energy from increasingly exotic sources, like atmospheric electricity and ionized particles, pressure and compression, strong nuclear forces, or all sorts of things.