After a new install of Debian, you may find that sudo won’t be available for updating and installing packages from the command line.
Besides that, in Debian, the user by default won’t have any sudo privileges either by to make any changes.
Here is how to fix it :
First, switch to root using su (using the root password that was set during installation process).
Having root access, edit the apt sources list. Any text editor like nano or vi can be used for this.
This is to download and update packages from the online repository rather than look for them from CD ROM / installation media.
On the lines that start with deb cdrom, add a # to comment out the CD ROM apt source. Save the changes and exit. (You can also configure allowing installation of non free packages from here.)
Now, run apt update and then install sudo utility using :
apt install sudo
What is left now is to add the existing user to sudoers group. Without that, regular user won’t be able to use sudo and error messages like the one below will be seen. Also, you’d need to switch to root everytime to run such commands.
To do this, use visudo command while being root from the command line.
Under User privilege specification section, add the user name with same privileges as root. Save the file and exit.
Now, exit root mode and as regular user, try running commands with sudo like updating packages or installing new ones.
The updates and installation of new packages in Debian will work as expected.
All done.
By the way, if you want to use a Debian based distros which work right out of the box without making any permission or system changes, here are a few of them.
Great it worked for me.
Thanks!!!
Glad you found it useful!
Why do you make things so complicated?
Simply by doing this will do the job (courtesy of the link below):
su
apt-get install sudo
https://chewett.co.uk/blog/477/sudo-command-not-found-debian-fixed/
I don’t understand your instructions, especially “On the lines that start with deb cdrom, add a # to comment out the CD ROM apt source. Save the changes and exit.”.
That is to make sure that packages can be updated from the Internet and not just from CD/DVD.