Unit 3: Networking, Packages, File Systems, and Virtualization

CSE493 — Linux System Administration 10 min read

I. System Administration Foundations

Linux system administration coordinates network connectivity, software, storage, and computing resources. Red Hat Enterprise Linux (RHEL) provides command-line tools, configuration files, services, and package repositories for managing these resources consistently.

  • Privilege model: Administrative operations normally require root privileges, commonly obtained through sudo.
  • Persistent configuration: Changes must survive reboot; persistent settings differ from temporary runtime changes.
  • Service management: systemctl controls systemd units, while journalctl examines their logs.
  • Verification principle: Configuration should be checked with status commands and operational tests rather than assumed to work.
  • Security principle: Administrators should use authenticated repositories, encrypted transfers, least privilege, and controlled network exposure.
  • Resource model: Linux exposes devices, partitions, file systems, network interfaces, packages, and virtual machines through standard management interfaces.

II. Network Administration — Connectivity and Name Resolution

A. Managing Red Hat Enterprise Linux Networking

RHEL networking is primarily managed by NetworkManager, which stores connection profiles and applies them to network interfaces.

  • Core service: Check NetworkManager with systemctl status NetworkManager.
  • Interface versus connection: An interface such as enp1s0 is hardware; a connection profile contains settings applied to it.
  • Configuration scope: Profiles can define addresses, routes, DNS servers, gateways, and automatic connection behavior.

B. Networking Concepts

Network communication depends on addressing, routing, naming, and transport protocols.

  • IP address: Identifies an interface; 192.168.10.20/24 has a 24-bit network prefix.
  • Gateway: Routes packets to destinations outside the local subnet.
  • DNS: Converts a name such as server.example.com into an IP address.
  • Ports: Identify services; SSH normally uses TCP port 22, while HTTPS uses TCP port 443.
  • IPv4 and IPv6: IPv4 uses 32-bit addresses; IPv6 uses 128-bit addresses such as 2001:db8::10.

C. Validating Network Configuration

Validation confirms that interfaces, routes, DNS, and remote services operate as intended.

  • Addresses: ip address show displays assigned addresses and interface state.
  • Routes: ip route shows the routing table, including the default gateway.
  • NetworkManager state: nmcli device status reports connected and disconnected devices.
  • Connectivity tests: ping -c 4 192.168.10.1 tests IP reachability; getent hosts example.com tests name resolution.
  • Listening services: ss -tuln lists TCP and UDP listening sockets.

D. Configuring Networking with nmcli

The nmcli utility creates, modifies, activates, and inspects NetworkManager profiles.

  • Display profiles: Use nmcli connection show.
  • Create a static profile:
BASH
nmcli connection add con-name office ifname enp1s0 type ethernet \
  ipv4.method manual ipv4.addresses 192.168.10.20/24 \
  ipv4.gateway 192.168.10.1 ipv4.dns 192.168.10.53
nmcli connection up office
  • Modify settings: nmcli connection modify office connection.autoconnect yes.
  • DHCP configuration: Set ipv4.method auto instead of manual.

E. Editing Network Configuration Files

Network configuration files provide persistent profile definitions when direct file management is necessary.

  • Keyfile location: Current RHEL releases store NetworkManager profiles under /etc/NetworkManager/system-connections/.
  • Protection: Keyfiles may contain secrets and generally require permissions such as mode 600.
  • Reloading: After editing, run nmcli connection reload, then reactivate the profile.
  • Legacy format: Older RHEL systems may use ifcfg-* files under /etc/sysconfig/network-scripts/.

F. Configuring Host Names and Name Resolution

Host names identify systems, while resolver configuration maps names to addresses.

  • Static hostname: Set it with hostnamectl set-hostname server1.example.com.
  • Verification: hostnamectl displays static, transient, and pretty host names.
  • Local mappings: /etc/hosts contains entries such as 192.168.10.20 server1.example.com server1.
  • DNS settings: NetworkManager normally generates /etc/resolv.conf from active profile settings.
  • Resolution check: getent hosts server1.example.com follows the system resolver configuration.

III. Archives and Remote File Transfer — Portable and Secure Data Movement

A. Archiving and Copying Files Between Systems

Archiving combines directory trees into one file, simplifying storage and transfer while preserving metadata.

  • Archive creation: tar -cf backup.tar /etc creates an uncompressed archive.
  • Inspection: tar -tf backup.tar lists members without extracting them.
  • Extraction: tar -xf backup.tar -C /restore extracts into /restore.
  • Preservation: tar records directory structure, permissions, ownership, and timestamps, subject to extraction privileges.

B. Managing Compressed tar Archives

Compression reduces archive size by passing tar data through a compression algorithm.

  • gzip: tar -czf backup.tar.gz /etc uses gzip and the z option.
  • bzip2: tar -cjf backup.tar.bz2 /etc uses bzip2 and j.
  • xz: tar -cJf backup.tar.xz /etc uses xz and J.
  • Extraction: tar -xzf backup.tar.gz extracts a gzip-compressed archive.
  • Trade-off: Stronger compression can reduce storage requirements but consume more CPU time.

C. Copying Files Between Systems Securely

scp and sftp transfer files through authenticated, encrypted SSH connections.

  • Upload: scp report.txt admin@server:/srv/reports/.
  • Download: scp admin@server:/var/log/messages ..
  • Directories: scp -r project/ admin@server:/srv/ copies recursively.
  • Authentication: SSH keys are preferable to repeated password entry and can be managed with ssh-keygen and ssh-copy-id.

D. Synchronizing Files Between Systems Securely

rsync efficiently synchronizes only changed data and can operate over SSH.

  • Archive mode: rsync -a recursively preserves common metadata.
  • Remote synchronization: rsync -av /data/ admin@server:/backup/data/.
  • Deletion behavior: --delete removes destination files absent from the source and therefore requires care.
  • Path semantics: A trailing slash in /data/ copies its contents; /data copies the directory itself.

IV. Software Package Management — Installation, Repositories, and Updates

A. Installing and Updating Software Packages

RHEL distributes software as RPM packages containing files, metadata, dependencies, and installation scripts.

  • Installation: yum install httpd resolves dependencies and installs the package.
  • Removal: yum remove httpd removes the package and evaluates dependencies.
  • Package search: yum search webserver searches available metadata.
  • Information: yum info httpd displays version, repository, architecture, and description.

B. Managing Software Updates with yum

yum compares installed packages with enabled repository metadata and performs dependency-aware updates.

  • Check availability: yum check-update reports packages with newer versions.
  • Update system: yum update downloads and installs applicable updates.
  • Single package: yum update openssl limits the transaction.
  • History: yum history records transactions and package changes.
  • Modern implementation: On RHEL 8 and later, yum is based on DNF technology.

C. Enabling yum Software Repositories

Repositories provide signed RPM packages and metadata through configured software sources.

  • List repositories: yum repolist --all displays enabled and disabled sources.
  • Temporary enablement: yum --enablerepo=repo-id install package.
  • Configuration: Repository definitions use .repo files under /etc/yum.repos.d/.
  • Trust: gpgcheck=1 requires RPM signature verification using an imported trusted key.

D. Examining RPM Package Files

RPM tools inspect package files and the database of installed packages.

  • Installed query: rpm -q bash reports the installed package version.
  • Package details: rpm -qi bash displays metadata.
  • Owned files: rpm -ql bash lists files installed by the package.
  • File ownership: rpm -qf /usr/bin/bash identifies the owning package.
  • Uninstalled file: rpm -qpi package.rpm inspects an RPM file without installing it.

E. Attaching Systems to Subscriptions for Software Updates

RHEL systems use subscription services to establish entitlement and repository access.

  • Registration: subscription-manager register associates the host with a Red Hat account or activation key.
  • Status: subscription-manager status reports registration and content-access state.
  • Repositories: subscription-manager repos --list-enabled shows enabled Red Hat repositories.
  • Removal: subscription-manager unregister disassociates the system when appropriate.

F. RPM Software Packages and Yum

RPM and yum serve related but distinct package-management roles.

  1. RPM layer: rpm installs or queries individual package files and maintains the local package database.
  2. Yum layer: yum uses repositories, downloads packages, verifies signatures, and resolves dependencies.
  • Practical rule: Prefer yum install ./package.rpm over rpm -i package.rpm when dependencies may be required.

V. Linux File Systems — Devices, Mounts, Links, and Search

A. Accessing Linux File Systems

Linux presents mounted file systems through one directory hierarchy rooted at /.

  • Mount points: Separate devices can appear at directories such as /home, /boot, or /mnt/data.
  • Path types: /var/log/messages is absolute; docs/report.txt is relative to the current directory.
  • Usage: df -h reports mounted file-system capacity; du -sh /var/log measures directory contents.

B. Identifying File Systems and Devices

Device and file-system identification prevents mounting or modifying the wrong storage.

  • Block inventory: lsblk -f displays devices, partitions, file-system types, labels, UUIDs, and mount points.
  • Persistent identity: UUIDs remain more reliable than names such as /dev/sdb1, which can change.
  • Detection: blkid reads file-system metadata.
  • Common types: RHEL commonly uses XFS, while ext4 remains widely supported.

C. Mounting and Unmounting File Systems

Mounting attaches a file system to the directory tree; unmounting detaches it safely.

  • Temporary mount: mount /dev/sdb1 /mnt/data.
  • Unmount: umount /mnt/data requires that no process is using the mount.
  • Persistent mount: /etc/fstab records device, mount point, type, options, dump value, and check order.
  • Validation: After editing fstab, use mount -a and inspect errors before rebooting.

D. Making Links Between Files

Links provide additional names or references to file-system objects.

  1. Hard link: ln source.txt copy.txt creates another directory entry for the same inode and cannot normally cross file systems.
  2. Symbolic link: ln -s /srv/data current stores a path and can cross file-system boundaries.
  • Removal behavior: Deleting one hard link does not remove data while another remains; a symbolic link can become broken.

E. Locating Files on the System

Linux offers indexed and real-time tools for locating files and commands.

  • Real-time search: find /var -type f -name "*.log" traverses /var.
  • Criteria: find can filter by owner, permissions, size, type, or modification time.
  • Indexed search: locate passwd searches a database that may require updatedb.
  • Command lookup: which ssh searches PATH; type cd also identifies shell built-ins.

VI. Virtualization — Hosting and Deploying Virtual Machines

A. Using Virtualized Systems

Virtualization runs isolated guest operating systems on virtual hardware managed by a hypervisor.

  • RHEL stack: KVM provides kernel virtualization, QEMU supplies device emulation, and libvirt provides management interfaces.
  • Guest resources: Each virtual machine receives virtual CPUs, memory, disks, and network adapters.
  • Requirements: Hardware-assisted virtualization normally uses Intel VT-x or AMD-V support.
  • Benefits: Isolation, consolidation, snapshots, and reproducible deployment improve infrastructure flexibility.

B. Managing a Local Virtualization Host

Libvirt tools control virtual machines, storage pools, and virtual networks on a host.

  • Service interface: virsh list --all displays defined guests.
  • Lifecycle: virsh start vm1, virsh shutdown vm1, and virsh reboot vm1 manage guest state.
  • Automatic startup: virsh autostart vm1 starts the guest when the host boots.
  • Graphical management: Virtual Machine Manager provides a desktop interface where available.

C. Installing a New Virtual Machine

A new virtual machine requires a guest definition, allocated resources, storage, networking, and installation media.

  • Preparation: Select CPU count, RAM, disk capacity, virtual network, and an installation ISO or network source.
  • Command installation:
BASH
virt-install --name rhel-vm --memory 4096 --vcpus 2 \
  --disk size=30 --network network=default \
  --cdrom /var/lib/libvirt/images/rhel.iso
  • Persistent definition: Libvirt stores the guest configuration so it can be stopped and restarted later.
  • Post-installation: Apply updates, configure networking, install guest tools, and verify host-to-guest connectivity.