Day 3
Welcome to Day 3 of the One-Week Linux Course! Today, we will dive deeper into Linux system administration, exploring topics such as package management, user management, and system configuration. By the end of the day, you will have a solid understanding of how to manage a Linux system effectively.
Agenda
- Day 3
- Agenda
- Operating Systems: Linux (Ubuntu/Debian)
- Introduction to Linux Operating Systems
- Understanding Distributions: Ubuntu, Debian
- Open-Source Philosophy
- Activities: Exploring Distributions, Open-Source Impact, License Awareness
- Installing Linux
- Dual-Booting with Windows
- Installation in a Virtual Machine
- Activities: Set Up VM, Dual-Boot
- Linux Desktop Environment
- GNOME Desktop Environment Overview
- Linux File System Structure
- Activities: Exploring the GNOME Interface, File System
- Linux System Configuration and Basic Commands
- Basic Linux Commands
- Linux System Configuration
- Activities: Practice Basic Commands, Manage Users, Modify Permissions
- Linux Package Management and Processes
- Package Management with APT
- System Services and Processes
- Activities: Installation, Monitoring, and Process Management
- Practical Exercises and Q\&A Day 3
- Additional Resources
- Key Takeaways
Operating Systems: Linux (Ubuntu/Debian)
Introduction to Linux Operating Systems
Understanding Distributions: Ubuntu, Debian
Linux is a family of open-source Unix-like operating systems based on the Linux kernel. Two popular distributions are Debian and Ubuntu.
Debian:
- Overview: One of the oldest and most stable Linux distributions, known for its robustness and conservative approach to software updates.
- Features:
- Stability: Ideal for servers and critical applications.
- Package Management: Uses the APT (Advanced Package Tool) system.
- Community-Driven: Maintained by volunteers worldwide.
- Use Cases: Servers, enterprise environments, and users who prefer stability over cutting-edge features.
Ubuntu:
- Overview: Based on Debian but with a focus on ease of use and regular releases.
- Features:
- User-Friendly: Simplified installation and configuration.
- Regular Updates: Releases every six months with Long-Term Support (LTS) versions every two years.
- Large Community: Extensive documentation and community support.
- Use Cases: Desktop users, developers, and those new to Linux.
Open-Source Philosophy
Open-Source Software (OSS) refers to software with source code that anyone can inspect, modify, and enhance.
- Principles:
- Freedom: Users have the freedom to run, copy, distribute, study, change, and improve the software.
- Collaboration: Encourages community collaboration and contribution.
- Transparency: Source code is available for examination, enhancing security and trust.
- Benefits:
- Cost-Effective: Often free to use, reducing software costs.
- Security: Community scrutiny can lead to more secure software.
- Customization: Users can modify software to suit their needs.
- Examples in Linux:
- Linux Kernel: Developed and maintained collaboratively.
- GNU Utilities: Core components that, combined with the kernel, make up a functioning operating system.
Activities: Exploring Distributions, Open-Source Impact, License Awareness
30-45 minutes
-
Explore Different Distributions (15 minutes):
-
Visit DistroWatch to compare Linux distributions.
- Discuss the differences between Debian and Ubuntu.
-
Identify which distribution might suit various use cases.
-
Discuss Open-Source Impact (15 minutes):
-
Reflect on how open-source software influences the tech industry.
-
Share examples of open-source software used daily.
-
License Awareness (15 minutes):
- Review the GNU General Public License (GPL) and its implications.
- Understand the importance of licensing in open-source projects.
Installing Linux
Dual-Booting with Windows
Dual-booting allows you to install both Windows and Linux on the same computer and choose which one to boot at startup.
- Preparation:
- Backup Data: Ensure all important data is backed up.
- Disk Space: Free up space on your hard drive for the Linux installation (at least 20 GB recommended).
- Download Linux ISO: Obtain the Ubuntu or Debian ISO image from the official website.
- Create Bootable Media:
- Use tools like Rufus (Windows) to create a bootable USB drive.
- Installation Steps:
- Boot from USB:
- Restart your computer and boot from the USB drive.
- Access the BIOS/UEFI settings if necessary to change the boot order.
- Start the Installer:
- Select "Install Ubuntu" or "Install Debian" from the menu.
- Partitioning:
- Choose "Install alongside Windows Boot Manager" or manual partitioning if you prefer.
- Allocate space for root (
/), swap, and optionally home (/home) partitions.
- Configure Settings:
- Set your time zone, keyboard layout, and create a user account.
- Install GRUB Bootloader:
- This will allow you to select between Windows and Linux at startup.
- Post-Installation:
- Reboot the system and test both operating systems.
- Update your Linux system using
sudo apt update && sudo apt upgrade.
Installation in a Virtual Machine
Installing Linux in a virtual machine allows you to run Linux within your current operating system.
- Advantages:
- No Risk to Host System: Does not affect your main OS or partitions.
- Easy to Manage: Start, stop, or delete the VM as needed.
- Virtualization Software:
- VirtualBox: Free and open-source.
- VMware Workstation Player: Free for personal use.
- Installation Steps:
- Install Virtualization Software:
- Download and install VirtualBox from virtualbox.org.
- Create a New VM:
- Open VirtualBox and click "New".
- Set the name (e.g., "Ubuntu VM") and select Linux as the type.
- Allocate memory (at least 2 GB) and create a virtual hard disk (at least 20 GB).
- Attach ISO Image:
- In the VM settings, under "Storage", add the Linux ISO as a virtual optical drive.
- Start the VM:
- Boot the VM and proceed with the Linux installation as you would on a physical machine.
- Install Guest Additions (Optional):
- Enhances performance and enables features like shared folders.
- Available in the VirtualBox menu under "Devices".
Activities: Set Up VM, Dual-Boot
45-60 minutes
-
Set Up a Virtual Machine (30 minutes):
-
Install VirtualBox and create a new Linux VM.
-
Go through the installation process, noting any differences from a physical install.
-
Dual-Boot Discussion (15 minutes):
-
Discuss the benefits and drawbacks of dual-booting vs. using a VM.
-
Consider scenarios where one method is preferred over the other.
-
Hands-On Practice (15 minutes):
- If possible, perform a live session boot from the USB without installing.
- Explore the Linux environment to get a feel for it.
Linux Desktop Environment
GNOME Desktop Environment Overview
GNOME is a popular desktop environment providing a graphical user interface (GUI) for Linux users.
- Navigating the GNOME Interface:
- Activities Overview:
- Access by clicking "Activities" or pressing the Super (Windows) key.
- View open windows and workspaces.
- Dash:
- The dock on the left side containing favorite and running applications.
- Top Bar:
- Contains system status icons, clock, and system menu.
- Application Menu:
- Access all installed applications.
- Customizing Desktop Settings:
- Change Background:
- Right-click on the desktop and select "Change Background".
- Adjust Themes and Appearance:
- Use GNOME Tweaks to adjust themes, icons, and fonts.
- Install GNOME Tweaks:
sudo apt install gnome-tweaks.
- Extensions:
- Enhance functionality with GNOME Extensions.
- Visit extensions.gnome.org to browse and install.
Linux File System Structure
Understanding the Linux file system hierarchy is crucial for navigation and system management.
- Key Directories:
/(Root): The top-level directory./home: Contains user home directories (e.g.,/home/username)./bin: Essential user command binaries (e.g.,ls,cp)./etc: System configuration files./var: Variable data files like logs and databases./usr: User-installed applications and utilities./tmp: Temporary files.- Understanding Permissions:
- Ownership: Each file/directory has an owner and group.
- Permissions: Read (
r), write (w), and execute (x) for owner, group, and others. - Viewing Permissions: Use
ls -lto see permissions and ownership.
Activities: Exploring the GNOME Interface, File System
30-45 minutes
-
Navigate the GNOME Interface (15 minutes):
-
Explore the Activities Overview, open applications, and switch between windows.
-
Use keyboard shortcuts like Alt + Tab to switch applications.
-
Customize the Desktop (15 minutes):
-
Change the desktop background and theme.
-
Install and use GNOME Tweaks to adjust settings.
-
Explore the File System (15 minutes):
- Use the Files application to browse directories.
- Identify key directories and discuss their purposes.
Linux System Configuration and Basic Commands
Basic Linux Commands
Command-Line Interface (CLI) is a powerful way to interact with the system.
- File Operations:
ls: List directory contents.ls -l: Long listing format.ls -a: Include hidden files.
cp: Copy files or directories.cp source destination.cp -r source_dir destination_dirfor directories.
mv: Move or rename files/directories.mv old_name new_name.
rm: Remove files or directories.rm file.txt.rm -r directoryto remove directories.
- Directory Navigation:
cd: Change directory.cd /path/to/directory.cd ..to move up one level.
pwd: Print working directory.- Shows the current directory path.
Linux System Configuration
Managing Users and Groups:
- Add a User:
sudo adduser username.- Follows prompts to set password and user information.
- Delete a User:
sudo deluser username.- Add a User to a Group:
sudo usermod -aG groupname username.- View Groups:
groups username.
File Permissions and Ownership:
- View Permissions:
ls -ldisplays permissions, ownership, and other details.- Change Permissions:
chmod permissions file.- Numeric method:
chmod 755 script.sh. - Symbolic method:
chmod u+x script.sh(adds execute permission to the user).
- Numeric method:
- Change Ownership:
sudo chown owner:group file.- Example:
sudo chown alice:alice file.txt.
- Example:
Activities: Practice Basic Commands, Manage Users, Modify Permissions
30-45 minutes
-
Practice Basic Commands (15 minutes):
-
Create, copy, move, and delete files and directories.
-
Use
touch filenameto create an empty file. -
Manage Users (15 minutes):
-
Create a new user and set a password.
-
Add the user to the
sudogroup for administrative privileges. -
Modify Permissions (15 minutes):
- Change permissions on a file using
chmod. - Observe the effects of different permission settings.
Linux Package Management and Processes
Package Management with APT
APT is the package management system used in Debian-based distributions.
- Update Package Lists:
sudo apt update.- Upgrade Installed Packages:
sudo apt upgrade.- Install a Package:
sudo apt install package_name.- Example:
sudo apt install git. - Remove a Package:
sudo apt remove package_name.- Search for Packages:
apt search keyword.
System Services and Processes
Monitoring System Performance:
top:- Displays real-time system processes and resource usage.
htop:- Enhanced version of
topwith a better interface. - Install with
sudo apt install htop. btop:- Another alternative to
topwith a more graphical interface. - Install with
sudo apt install btop. ps:ps auxlists all running processes.
Managing Processes:
- Kill a Process:
kill PIDsends a signal to terminate a process.- Find PID using
psortop. - System Services:
- Systemd is used to manage services.
- Start a Service:
sudo systemctl start service_name.
- Stop a Service:
sudo systemctl stop service_name.
- Enable a Service at Boot:
sudo systemctl enable service_name.
Activities: Installation, Monitoring, and Process Management
45-60 minutes
-
Install and Update Software (15 minutes):
-
Update package lists and upgrade packages.
-
Install a new application like
htoporcurl. -
Monitor System Resources (15 minutes):
-
Use
topor betterhtoporbtopto view running processes. -
Identify processes consuming the most resources.
-
Manage Services (15 minutes):
-
Start, stop, and enable services like
ssh. -
Check the status of a service using
systemctl status service_name. -
Practice Killing Processes (15 minutes):
- Start a process and identify its PID.
- Use
killto terminate the process.
Practical Exercises and Q&A Day 3
Hands-On with Commands and Configurations
User Management
- Create a new user and set appropriate permissions.
- Add the user to a group and modify group memberships.
File System Navigation
- Navigate through directories using the command line.
- Create, move, and delete files and directories.
Customize GNOME
- Install GNOME Tweaks and adjust settings.
- Install an extension to enhance functionality.
Package Management
- Install a software package.
- Remove an unwanted package.
- Update the system and review installed packages.
Process Management
- Monitor system resources using
htop. - Identify and terminate a specific process.
Closing Questions
- Any questions about any of the topics covered today?
TODO: Provide clarifications and additional examples as needed.
Additional Topics: File System Permissions, Package Management, System Services, Process Management.
Additional Resources
Articles
- Linux Tutorial for Beginners by Ryan's Tutorials.
- Understanding the Linux File System by Red Hat.
Interactive Tutorials
- Linux Survival: Interactive command-line tutorial.
- OverTheWire: Bandit: Practice Linux commands in a game format.
Key Takeaways
- Linux offers flexibility and control over your computing environment.
- The command line is a powerful tool for system administration.
- Understanding the file system and permissions is crucial for security and organization.
- Open-source software fosters collaboration and innovation.
- Regular system updates and maintenance are essential for stability and security.