Actually 'sudo' command provides administrator privileges. When we create a new server it has a default 'root' user. So, here I'm going to create a new user with sudo access.
Open your terminal and write the following command
root@localhost:~$ adduser [username]
Now you need to give 'sudo' permission to the newly created user. So, use the usermod command in the terminal. Command is given bellow -
root@localhost:~$ usermod -aG [username]
Now, the new user added to the sudo group. you can check by this command -
root@localhost:~$ su - [username]
And run any command with 'sudo' in the terminal -
username@localhost:~$ sudo apt-get update
If you want to add sudo to the existing user then just follow the step three.
Thanks for reading <3