Remove the Old Cable
To loosen the cable, shift the chain onto the smallest front chain ring and smallest rear cog.
Use a 5 mm hex key to loosen the cable fixing bolt on the front derailleur.
Use the cable cutter to cut the cable at the cable end-cap.
Pull the cable out of the cable fixing bolt, out of the cable-routing on the underside of the bottom-bracket, and through the barrel adjuster near the headset. Take note of, and remember how, the cable was routed. You will re-trace this route, in reverse, with your new cable.
Pull the brake-lever and keep it pulled toward the handlebar using either a thick rubber band or a hook-and-loop strap. This shows the cable access hole where the cable routes into the shifter.
Push the cable out of the access hole and pull it out by the cable head.
Install the New Cable
Use a new cable that is at least as long as the old cable.
Use a cable cutter to cut your new cable housing to be the same length as the old one. One end of the housing has a "Shimano" marking on it. Cut the other end. Squeeze the cut end to make the opening round.
Insert the new cable into the cable access hole from the lateral side of the shifter and pull it out from the frame side of the shifter.
Insert a ferrule and then the cable-housing where the cable exits the shifter. Push the ferrule and cable housing firmly into the exit.
Insert another ferrule at the other end of the cable housing where the cable enters the barrel adjuster. Seat the ferrule and cable housing there firmly.
Route the cable back through the cable routing on the underside of the bottom bracket and back into the cable fixing bolt on the derailleur.
Use the cable cutter to cut the cable 1 to 2 cm past the bolt and use pinch an end cap on the end.
Use needle-nosed pliers to hold the cable tight and use a 5 mm hex key to tighten the cable fixing bolt.
Remove the rubber band or hook-and-loop strap from the shifter and handlebar.
Turn your handlebars to make sure there is a full range of motion, and the cable moves easily without pulling and without interference with the other cables or accessories you may have installed on your handlebars.
Shifter Cable Adjustment
With the chain on the small chain ring, tighten the cable by turning the barrel adjuster counterclockwise.
Use the barrel adjuster to adjust the cable so that it is tight enough for the chain to move immediately when you shift, but loose enough for the chain to drop smoothly to the small ring.
Shift back and forth to be sure that the shifts occur reliably.
Take your bike out on the road and fine tune while you ride.