Linux Fundamentals: System Installation and Directory Structure Mastery
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
- Language Selection: Choose your preferred language (Chinese or English)
- Software Selection: For production environments, minimal installation is recommended. For learning purposes, select the desktop environment option.
Partition Configuration:
- Select "I will configure partitioning" and click Done
Click the "+" button to add partitions:
/boot: 1GB, ext4 filesystemswap: 2GB, swap filesystem/(root): Remaining space (minimum 17GB), ext4 filesystem
- Network Configuration: Set your hostname and configure network settings
- Security Policy: You may disable security policies to simplify password requirements during initial setup
- User Creation: Set your root password and create a regular user account
- Installation: Begin the installation process and wait for completion
- 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)
- Boot into CentOS
- Select VM → Install VMware Tools from the menu
- A CD-ROM icon appears containing the installation package
Copy the
.tar.gzfile to/opt:cd /opt tar -zxvf VMwareTools-*.tar.gzNavigate to the extracted directory:
cd vmware-tools-distribRun the installer:
./vmware-install.pl- Accept default settings throughout the installation
Note: GCC compiler must be installed for VMware Tools compilation.
Configuring Shared Folders
- Create a shared folder on the host (e.g.,
D:\VMShare) - In VMware: VM → Settings → Options → Shared Folders
- Select "Always enabled" and add your folder
- 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
| Directory | Purpose |
|---|---|
/boot | Contains boot files, kernel images, and bootloader configuration |
/dev | Device files representing hardware (similar to Windows Device Manager) |
/bin | Essential user commands available to all users |
/sbin | System administration commands (super user binaries) |
/home | User home directories (one per user, named after username) |
/root | Home directory for the root (administrator) user |
/lib | Shared libraries required for system boot and operation (similar to Windows DLLs) |
/lost+found | Typically empty; stores recovered files after improper shutdowns |
/etc | System configuration files and subdirectories |
/usr | User applications and files (similar to Windows Program Files) |
/proc | Virtual directory mapping system memory and kernel parameters (do not modify) |
/srv | Service data extracted after service startup (do not modify) |
/sys | Sysfs filesystem for kernel device information (do not modify) |
/tmp | Temporary files (cleared on reboot) |
/media | Auto-mounted removable devices (USB drives, CDs) |
/mnt | Manual mount point for temporary filesystem mounting |
/opt | Optional software installations (Oracle, etc.) |
/usr/local | Locally compiled software installations |
/var | Variable data (logs, spools, caches)—frequently modified content |
/selinux | Security-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.