I am about to buy a VPS server but they preinstall debian 3.1 and it seem abit ancient version thus I need to upgrade to 5 version (lenny), is it easy to upgrade 3.1 to 5 via ssh ? If so what would be the command(s) ?
Upgrading direct from 3.1 (sarge?) to 5 (lenny) is, IIRC, not a supported operation.
What you will need to do is:
This can all be done over SSH successfully (I've done woody->etch and etch->lenny myself a few times), but be careful to follow the instructions and definitely take those backups just-in-case.
This will take some time, so if you can afford to overlap your VPS with another for a short period you might be better off getting a new VPS with a fresh Lenny (5.0) install, migrating your services and content over to it, then closing down the old VPS. This will cost more (you'd have two VPSs to pay for for a month, assuming you pay monthly) but may take a chunk less of your time and will result in a cleaner install too (as you won't transfer over all the cruft that has collected over the years).
I dont think 3 to 5 is supported. you may want to find a more up-to-date VPS vendor.