Public Transport: within Campania the public transport has a unified ticket system called Campania Unico. Tickets are organised in zones which means that with one ticket you can travel within one zone (usually defined by how long it takes , someone could try to explain better!), two or more. Included in this system are generally national trains (also to Paestum, the underground in Naples, the Funicolore in Naples, Cita buses along the Amalfi Coast, the Funicolore on Capri, the Circumvesuviana that goes also past Pompeii and Herculaneum but NOT ferries. The advantage is not only, that you can get tickets for different kind of vehicles, but you could also buy tickets in advance for areas where it is difficult to find a ticket office such as Paestum, as the tickets start to be valid once you stamped them. It is possibly also cheaper to buy a bunch of 'one zone' tickets than each time a new one. But careful: some tickets are locally bound (only in Naples, for example). If in doubt, ask when you buy your tickets.
By Train: National train lines go from Naples to Salerno and further east and southwards. The Circumvesuviana is a local private train link serving the area around the Mount Vesuvius from Naples to Sorrento. The service has the appeal of typical metropolitan trains connecting to local suburbs (including the odd graffiti and cut open seat/window). For tourists this train service is particularly interesting because it is the only reasonable public transport link to Pompeii, Herculaneum and the Vesuvius. Note: there are several different lines but ONLY THE BLUE LINE goes to Pompeii, Herculaneum and the Vesuvius. Check the [Circumvesuvia official website] for details. (Italian, the English link on the website is broken. Click on 'Orario Ferrovia' to get comprehensive timetables as PDF)
By Car: The Amalfi-Sorrento-Salerno road is narrow and full of hairpin turns. Cars passes fast and close. Take care.