Upgrading from 5 to 6.5 can take quite a while! So get a snack!
You'll need to login into your ESXi host via SSH. This isn't enabled by default so you'll have to enable it first.
Once logged in, here are the commands used for the upgrade:
esxcli system version get
esxcli network firewall ruleset set -e true -r httpClient
esxcli software sources profile list -d
https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml | grep -i ESXi-6
esxcli software profile update -p ESXi-6.5.0-4564106-no-tools -d http://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml