Quick hint: you can ssh into your sever and then cut and paste all thecommands from a file or ths web page. That is what I am doing now.
Step 1: Server Update.
$ sudo apt-get update
Do the upgrade
$ sudo apt-get upgrade
In some cases if you did a system upgrade instead of a clean install, you might not get all packages upgraded.
$ sudo apt-get dist-upgrade will usually do the job.
Last of all some clean up.
$ sudo apt-get autoclean