Log into your server as the root user. First update your package repository data:
Then install sudo with:
Sudo is now installed, but by default only the root user can use it, which is not what we want. On installation sudo adds a new user group "sudo" to the system. All users in that group are allowed to run the sudo command so we have to add your user to this grup. You can do this with the following command:
apt install sudo
This adds a user called "foo" to the sudo group. Obviously you have to replace "foo" with your username.
adduser foo sudo