The train ticket, you have to buy it in train station - the only possibility because they need your passport. There you can check schedules and prices. >>
http://www.litrail.lt/
You don't have to show them a visa. Visa is examined at customs.
If you want to buy a ticket online, you can try buses:
Ecolines costs about 45 Litas (about 13 EUR)
http://ecolines.net it takes about 4 hours - they have wi-fi.
Eurolines the same.