Welcome to the second lesson. Now that you have a fresh installation of Rocky Linux, our next step is to perform some essential post-installation tasks. In the previous lesson, we successfully installed the "Server with GUI" environment, and you even resolved a common issue by enabling the graphical target. Today, we will build on that foundation by ensuring your system is fully updated and by properly configuring user accounts for administrative tasks.
This lesson is all about establishing good security and system management habits from the start. We'll perform the first system-wide update to patch any bugs or vulnerabilities. Then, we will dive into how Linux handles user privileges, ensuring your user account has the necessary permissions to manage the system without needing to log in as the all-powerful root user.
1. Performing Initial System Updates
Before installing any new software, it's a critical first step to update the system. This process downloads and installs the latest versions of all software packages currently on your machine, including important security patches and bug fixes. On Rocky Linux, this is handled by the dnf package manager.
You'll need to use the terminal for this. You can open it by clicking on "Activities" in the top-left corner, typing "terminal", and selecting the application.
The command to update your system is sudo dnf update. Let's break that down:
sudo: This stands for "superuser do" and is a command that allows you to run other commands with the administrative privileges of therootuser. You will be prompted for your own user's password, not therootpassword.dnf: This is the software package manager for Rocky Linux. It handles installing, updating, and removing software.update: This is the action you're tellingdnfto perform.
The following resource explains this process well.
Managing Software Packages with DNF on Rocky Linux 9 | Reintech media
This article from Reintech media gives a concise overview of using the dnf package manager. We'll focus on its explanation of the update process.
Please read the section Getting Started with DNF. It explains the core dnf update command and the useful -y flag for non-interactive updates, which is something you'll find handy later when writing automation scripts.
Now, go ahead and run the update command in your terminal:sudo dnf update
The system will list all the packages that need to be updated and ask for your confirmation.
Your terminal output will look similar to this, listing all packages to be upgraded.
Press y and then Enter to proceed. This process might take some time, depending on how many updates are available and your internet speed.
2. Creating a Non-Root User with sudo Privileges
In the last lesson, during the installation, you created a user account and checked the box for "Make this user administrator". This was an important step. In the Linux world, it is a fundamental security principle to avoid using the root account for daily activities. The root user has unlimited power and can accidentally cause irreversible damage to the system.
Instead, administrators use a standard user account that has been granted sudo privileges. The installer's "Make this user administrator" checkbox is a convenient shortcut. It works by adding your user to a special group called wheel. By default on Rocky Linux, any user in the wheel group is allowed to use sudo.
Let's verify this. In your terminal, run the following command:groups
You should see a list of groups your user belongs to, and wheel should be one of them. Now, test your sudo access by running a command that requires it, like asking the system who it thinks you are when you're an administrator:sudo whoami
After you enter your password, the command should output root. This confirms that you can successfully execute commands with administrative privileges.
To solidify your understanding and to be able to replicate this process without a graphical installer, let's walk through the manual process of creating a new user and granting them sudo privileges. We will create a temporary user for this exercise.
Initial Server Setup with Rocky Linux 9 | DigitalOcean
This DigitalOcean guide provides the standard, command-line procedure for creating users and granting them sudo rights on Rocky Linux. It's the "by-the-book" method.
Read through Steps 2 and 3. Pay close attention to the sequence of commands: adduser, passwd, and usermod. This is the exact process for manually setting up an administrator.
Now, let's apply what you've just read. We'll create a temporary user named testadmin.
-
Create the user:
sudo adduser testadmin -
Set a password for the new user:
sudo passwd testadmin
(You will be prompted to enter and confirm a new password.) -
Grant
sudoprivileges by adding the user to thewheelgroup:sudo usermod -aG wheel testadmin
The-aGflags are important:-ameans append (add the user to the group without removing them from other groups) and-Gspecifies the group name.
Now, let's verify that testadmin has the correct privileges without even logging in as them. The sudo -lU <username> command lists the privileges for a user.
sudo -lU testadmin
The output should confirm that the user 'may run the following commands: (ALL) ALL', similar to what is shown here for the user 'senthil'.
You have successfully created a new administrative user from the command line. Since this was just an exercise, you can now remove the temporary user and their home directory:sudo userdel -r testadmin
This manual process gives you the fundamental knowledge to manage users on any Rocky Linux server, regardless of whether a GUI is available. While the wheel group method is standard, it's worth knowing that another common practice, especially for managing multiple specific permissions, is to add configuration files to the /etc/sudoers.d/ directory. This isolates user permissions into separate files, which can be cleaner to manage, a concept that will likely resonate given your experience with modular code.
Key Takeaways
- You should always perform a system update with
sudo dnf updateon a new installation. - Using the
rootaccount for everyday tasks is a security risk. Administrative work should be done from a regular user account withsudoprivileges. - On Rocky Linux, making a user an administrator is typically done by adding them to the
wheelgroup. - The command
usermod -aG wheel <username>is the manual way to grantsudorights to an existing user. - You can verify a user's
sudoabilities withsudo -lU <username>.
Next Steps
Your system is now updated and secure. The next logical step is to prepare the hardware for the demanding task of real-time video processing for gesture recognition. In the next lesson, we will install the proprietary NVIDIA drivers for your GTX 1650 Super and verify that the GPU is ready for action.