Introduction to Linux

Linux stands as an open-source, free operating system whose stability, security, and concurrent processing capabilities have earned widespread industry recognition. Today, enterprise-level projects spanning C/C++, PHP, Python, Java, and Go are predominantly deployed on Linux/Unix systems.

The Linux ecosystem offers numerous distributions, each serving different needs:

  • Ubuntu: User-friendly, ideal for beginners and desktop use
  • RedHat: Enterprise-focused with commercial support
  • CentOS: Community-driven enterprise distribution
  • Debian: Known for stability and extensive package repositories
  • Fedora: Cutting-edge features and innovations
  • SUSE/OpenSUSE: Popular in European enterprise environments

It's crucial to understand that Linux refers specifically to the kernel, while distributions represent packaged versions of the kernel combined with user-space tools and applications.

Linux Installation Process

Installing Linux requires creating a virtual machine environment first, then installing the operating system within it. This guide focuses on CentOS installation using VMware.

Prerequisites

Before beginning installation, ensure your system supports hardware virtualization. Check this through Task Manager → Performance → CPU → Virtualization. If virtualization is disabled, you must enable it in your BIOS/UEFI settings.

Virtual Machine Configuration

When creating your virtual machine, allocate resources appropriately:

  • CPU: 2 cores minimum for comfortable operation
  • Memory: At least 2GB for desktop environments
  • Storage: 20GB minimum for the system partition

Installation Steps

  1. Language Selection: Choose your preferred language (Chinese or English)
  2. Software Selection: For production environments, minimal installation is recommended. For learning purposes, select the desktop environment option.
  3. Partition Configuration:

    • Select "I will configure partitioning" and click Done
    • Click the "+" button to add partitions:

      • /boot: 1GB, ext4 filesystem
      • swap: 2GB, swap filesystem
      • / (root): Remaining space (minimum 17GB), ext4 filesystem
  4. Network Configuration: Set your hostname and configure network settings
  5. Security Policy: You may disable security policies to simplify password requirements during initial setup
  6. User Creation: Set your root password and create a regular user account
  7. Installation: Begin the installation process and wait for completion
  8. First Boot: After rebooting, accept the license agreement and log into your new system

Network Connection Modes

Understanding virtual machine networking is essential for proper system configuration.

Bridged Mode

In bridged mode, the Linux virtual machine's IP address (e.g., 192.168.0.11) resides on the same network segment as the host machine (e.g., 192.168.0.14). This enables direct communication with external networks but carries the risk of IP conflicts with other devices on the local network, as the LAN DHCP server is unaware of the VM's IP reservation.

NAT Mode

Network Address Translation mode allows the virtual system to communicate externally while avoiding IP conflicts. The VM operates on a different network segment, routing traffic through the host machine as a proxy. However, external systems cannot directly initiate connections to the VM—a consideration important for server deployments.

Host-Only Mode

This creates an isolated system that communicates only with the host machine, providing a secure environment for testing but no external connectivity.

Virtual Machine Cloning

When you need additional Linux systems, cloning offers significant time savings over fresh installations.

Method 1: Direct File Copy

Simply copy the entire virtual machine folder to a new location. To use the cloned VM, open VMware, select File → Open, and navigate to the .vmx configuration file in the copied folder. This method is particularly useful for sharing complete development environments with colleagues.

Method 2: VMware Clone Feature

Right-click the virtual machine, select Manage → Clone, and follow the wizard. Important: The VM must be powered off before cloning.

Virtual Machine Snapshots

Snapshots enable reverting to previous system states—essential when experimental changes cause system instability.

Creating Snapshots

Right-click the VM → Snapshot → Take Snapshot. Provide a descriptive name and optional description.

Restoring Snapshots

Right-click the VM → Snapshot → Snapshot Manager. Select the desired snapshot and click "Go To" to restore that exact system state.

VMware Tools Installation

VMware Tools enhances integration between host and guest systems, enabling features like shared folders and improved performance.

Installation Steps (as root user)

  1. Boot into CentOS
  2. Select VM → Install VMware Tools from the menu
  3. A CD-ROM icon appears containing the installation package
  4. Copy the .tar.gz file to /opt:

    cd /opt
    tar -zxvf VMwareTools-*.tar.gz
  5. Navigate to the extracted directory:

    cd vmware-tools-distrib
  6. Run the installer:

    ./vmware-install.pl
  7. Accept default settings throughout the installation

Note: GCC compiler must be installed for VMware Tools compilation.

Configuring Shared Folders

  1. Create a shared folder on the host (e.g., D:\VMShare)
  2. In VMware: VM → Settings → Options → Shared Folders
  3. Select "Always enabled" and add your folder
  4. Access the shared folder in Linux at /mnt/hgfs/

This enables seamless file exchange between host and guest systems, though production environments typically use remote file transfer methods instead.

Linux Directory Structure

Linux employs a hierarchical tree-structured directory system, with the root directory "/" at the apex. In the Linux philosophy, everything is treated as a file.

Essential Directories

DirectoryPurpose
/bootContains boot files, kernel images, and bootloader configuration
/devDevice files representing hardware (similar to Windows Device Manager)
/binEssential user commands available to all users
/sbinSystem administration commands (super user binaries)
/homeUser home directories (one per user, named after username)
/rootHome directory for the root (administrator) user
/libShared libraries required for system boot and operation (similar to Windows DLLs)
/lost+foundTypically empty; stores recovered files after improper shutdowns
/etcSystem configuration files and subdirectories
/usrUser applications and files (similar to Windows Program Files)
/procVirtual directory mapping system memory and kernel parameters (do not modify)
/srvService data extracted after service startup (do not modify)
/sysSysfs filesystem for kernel device information (do not modify)
/tmpTemporary files (cleared on reboot)
/mediaAuto-mounted removable devices (USB drives, CDs)
/mntManual mount point for temporary filesystem mounting
/optOptional software installations (Oracle, etc.)
/usr/localLocally compiled software installations
/varVariable data (logs, spools, caches)—frequently modified content
/selinuxSecurity-Enhanced Linux policy configuration

Key Principles

Understanding the directory structure is fundamental to Linux proficiency. The separation of system files (/bin, /sbin, /lib), configuration (/etc), user data (/home), and variable content (/var) enables organized system management and simplifies backup strategies.

The /usr hierarchy deserves special attention—it contains the majority of user-installed software and follows its own internal structure with /usr/bin, /usr/lib, /usr/share, and /usr/local for locally compiled software.

Conclusion

Mastering Linux installation and directory structure provides the foundation for all subsequent system administration tasks. Whether deploying servers, developing applications, or managing enterprise infrastructure, these fundamentals remain essential. Practice with virtual machines enables safe experimentation, while understanding the directory hierarchy ensures efficient navigation and system management.