Adventures in Linux: First Install

I’ve used Linux on and off for a while, but never as a main desktop. My Chromebook supports Linux apps and it has helped me ease into giving Linux a chance as a daily driver (well more like a co-driver). I wasn’t using my Intel NUC much so I decided to dedicate it as a Linux machine. I installed the latest version of Debian on it with XFCE. I picked Debian over Ubuntu because the latter seemed to be geared more towards beginners and I wanted to use a well supported distro that will force me to get the most out of Linux. I can most likely get the same out of Ubuntu but since I’ve used it so many times I also wanted a change, and since Ubuntu is based on Debian there will be similarities.

I did a minimal install of Debian so I would be forced to install everything I needed one by one. Come to think of it, I should’ve not told the installer to install XFCE for me. To make up for this, in the future I will uninstall XFCE and install a different desktop to see how the process goes.

The Debian install was painless, but when beginning to use the system and trying to install new packages I came across an issue.

bash: sudo: command not found

WHAT?!!! I’m so used to using sudo from Ubuntu, ChromeOS and the Raspberry Pi! Turns out Debian does not have sudo preinstalled. If I do not want to keep switching to the root account to install software or make changes to the system then I need to install sudo. To do this I need to be in Super User mode in a terminal. I do this by typing:

su -

I’m asked for the root password. After typing it, I get taken to the root account. I want to install sudo and I do this by typing.

apt-get install sudo

To see if it is installed, I typed “sudo” and I got its usage info. So it works. Now let me leave super user mode and try “apt-get update” on my regular account.

It didn’t work! I get this error:

username is not in the sudoers file.  This incident will be reported.

So I guess I need to manually add my regular account to a file called “sudoer.”

So why not just use the root account to make all changes? Because su always asks for the root password. So anyone who uses the machine that needs sudo access will need to know the root password. sudo, on the other hand, will only ask for the current users password. So no need to give the root password to everyone.

I found out that this file is located at /etc/sudoers. To safely edit this file, I read that it’s best to use visudo.
To read why and get more info on visudo go to https://www.sudo.ws/man/1.8.17/visudo.man.html.

So let’s go back into the root account by typing su –. Then type visudo.

What I want to do from this file is give my regular account (lutech) the ability to execute the sudo command. In the sudoers file, there is this section:

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

This means that there is a group call sudo and if I add a user to that group they will automatically get sudo access. So it turns out we do not have to edit the sudoers file to give my account sudo I access. I can just add the account to the sudo group, unless I want to individually give the account permissions in sudoers. I’ll show you both ways. To give an individual account sudo permissions in the sudoers file, under the #User privilege specification section just type

username    ALL=(ALL:ALL) ALL

Where username is the name of the user you want to give access to. Exit and save the file. It tested the change by typing sudo apt-get update on the lutech account and it worked!

Now let’s give sudo access by adding a user to the sudo group. To do this type:

sudo usermod -aG sudo username

Again, where username is the name of the user you want to add to the group sudo. However, when testing a sudo apt-get update command right away on my lutech account, it did not work. I still got the not in the sudoers file error. To fix this, I had to first restart the computer, and then the command worked. Maybe logging out and back in might work, but I did not try that.

Anyway, so that’s my adventure in getting sudo to work. This experience is exactly what I was trying to get out of Debian and I learned a little more on how Linux worked. I never experienced this in Ubuntu so I’m liking my decision to go with Debian for now.

My next adventure is going to involve getting the sound and wifi to work.

2 Comments

  1. psychocod3r's avatar psychocod3r says:

    I started off with Debian, for basically the same reason you did. I had never used Ubuntu in the past, and now I’m thinking I probably should have started with Ubuntu just to get used to the system. I used a net install, and the first time I did it it wasn’t connected to an Ethernet, so it ended up not downloading the right files. The system had no GUI and it was missing a lot of other stuff as well. So I ran the net installer again with my laptop plugged directly into my parents’ Ethernet switch, and that installed everything. There were a few things I had to install after that; for example the WiFi wasn’t working at first, so I had to install the driver manually.

    I now use Arch Linux, which is another distro that forces you to install everything yourself, even more so than Debian. I currently run it live from a CD-ROM that I burned the ISO to, and the sequence of steps I use to set it up is rather similar to what you’re doing, only there are a lot of additional steps (I’ve detailed the exact sequence here). So if you really want to learn the system, I’d suggest trying out Arch Linux after you’ve gotten used to Debian. It’s basically the next step to mastering Linux. After that you can try building your own custom distro with Linux From Scratch (which I have no experience with, and I’m not nearly at that level yet). That’s the nice thing about Linux: you never stop learning.

    Like

  2. This is amazing insight you are giving me!

    Believe me, I understand your frustration when you started with a net install of Debian. My first experience with Linux was in 1997, and it had to do with me voluntarily erasing my Windows install just to try out this new OS I heard about. I was in college at the time and unfortunately I had a paper due in a couple of days, and this new OS just gave all sorts of problems. Despite all my efforts, I just had no time to deal with those issues and just install Windows again.

    Anyway, you just gave me some inspiration for my next post. I’m going to talk about my first experience with Linux (which wasn’t good at all) and how I’ve warmed up to it. It really is a great OS. I look forward to trying out Arch Linux!

    Like

Leave a reply to psychocod3r Cancel reply