Up arrow for history does not work over SSH

History is not present in all shells. You need to start a shell with history like bash. To do so, just type the name of the shell, like

bash

or the full path of the executable, like

/bin/bash

It appears that your login shell is /bin/sh. On Ubuntu, this is a shell intended for scripting, it doesn't have any comfortable command line edition feature such as history. To get a proper command line shell, change your login shell to bash or zsh:

chsh -s /bin/zsh

or

chsh -s /bin/bash

If that machine has restrictions which prevent you from changing your login shell, you can tell sh to execute bash or zsh when logging in. See how can I use bash as my login shell when my sysadmin refuses to let me change it