Linux Fundamentals: System Installation and Directory Structure Guide
Introduction to Linux
Linux stands as one of the most significant technological achievements in modern computing—an open-source, free operating system whose stability, security, and multi-concurrent processing capabilities have earned universal industry recognition. Today, virtually every enterprise-level project (whether built with C/C++, PHP, Python, Java, or Go) deploys on Linux or Unix-based systems.
Understanding Linux isn't merely an optional skill for developers—it's a fundamental requirement for anyone serious about software development, system administration, or infrastructure engineering. This comprehensive guide walks you through Linux installation, configuration, and the essential directory structure that forms the foundation of the entire ecosystem.
Linux Distribution Landscape
It's crucial to understand that "Linux" technically refers only to the kernel—the core component that manages system resources. What most people call "Linux" are actually distributions (distros)—complete operating systems built around the Linux kernel with additional software, package managers, and configuration tools.
Major Linux Distributions
The Linux ecosystem offers numerous distributions, each targeting different use cases:
- Ubuntu: User-friendly, excellent for beginners and desktop use
- Red Hat Enterprise Linux (RHEL): Commercial distribution with enterprise support
- CentOS: Community-driven, binary-compatible with RHEL (now transitioning to CentOS Stream)
- Debian: Known for stability and strict free software guidelines
- Fedora: Cutting-edge features, sponsored by Red Hat
- SUSE/OpenSUSE: Popular in European enterprise environments
Each distribution brings unique characteristics, but they all share the same fundamental Linux kernel and directory structure—knowledge transfers seamlessly between them.
Linux Installation: Virtual Machine Setup
For learning and development purposes, installing Linux in a virtual machine provides the perfect balance of safety and functionality. You can experiment freely without risking your host system, take snapshots before major changes, and easily revert if something goes wrong.
Prerequisites: Virtualization Support
Before installing any virtual machine software, ensure your system supports hardware virtualization:
- Open Task Manager (Windows) or Activity Monitor (macOS)
- Navigate to Performance → CPU
- Verify that "Virtualization" shows as enabled
If virtualization is disabled, you'll need to:
- Restart your computer
- Enter BIOS/UEFI setup (typically by pressing F2, F10, or Delete during boot)
- Locate virtualization settings (Intel VT-x or AMD-V)
- Enable the feature
- Save changes and reboot
Step 1: Install Virtualization Software
VMware Workstation (version 15.5 or later recommended):
- Download from the official VMware website
- Run the installer with default settings
- Accept the license agreement
- Complete the installation and restart if prompted
Alternative Options:
- VirtualBox: Free, open-source alternative
- QEMU/KVM: Native Linux virtualization
- Hyper-V: Built into Windows Pro editions
- Parallels: Popular for macOS
Step 2: Download Linux Distribution
For this guide, we'll use CentOS 7.6 or CentOS 8.1 as examples. These versions offer excellent stability and widespread enterprise adoption.
Download links are typically available from:
- Official distribution websites
- Mirror servers (faster for specific regions)
- Educational institution mirrors
Step 3: Create the Virtual Machine
Launch VMware and follow these steps:
Create New Virtual Machine
- Click "Create a New Virtual Machine"
- Select "Custom (advanced)" for detailed configuration
- Click Next
Hardware Compatibility
- Choose Workstation 15.x compatibility
- Click Next
Installation Media
- Select "Installer disc image file (iso)"
- Browse to your downloaded CentOS ISO
- Click Next
Operating System Selection
- Choose "Linux" as guest OS
- Select "CentOS 64-bit" as version
- Click Next
Virtual Machine Name
- Enter a descriptive name (e.g., "CentOS-Learning")
- Choose storage location
- Click Next
Processor Configuration
- Allocate 2 CPU cores with 2 threads each
- This provides adequate performance for learning
- Click Next
Memory Allocation
- Assign 2-4 GB RAM depending on host capacity
- Avoid over-allocating (leave resources for host)
- Click Next
Network Configuration
- Select "Network Address Translation (NAT)"
- This allows internet access without IP conflicts
- Click Next
I/O Controller Types
- Accept default LSI Logic recommendations
- Click Next
Disk Type
- Choose "SCSI" for best compatibility
- Click Next
Select Disk
- Choose "Create a new virtual disk"
- Click Next
Specify Disk Capacity
- Allocate 20-40 GB depending on intended use
- Select "Store virtual disk as single file"
- Click Next
Specify Disk File
- Accept default filename or customize
- Click Next
Review and Finish
- Verify all settings
- Click "Customize Hardware" for additional options
- Click Finish
Step 4: Install CentOS
With the virtual machine created, power it on to begin OS installation:
Boot from ISO
- The VM automatically boots from the installation media
- Wait for the boot menu to appear
Language Selection
- Choose your preferred language
- For learning purposes, consider selecting Chinese or English based on comfort level
- Click Continue
Software Selection
- Production environments: Choose "Minimal Install" for reduced attack surface
- Learning/Development: Select "Server with GUI" or "Workstation" for desktop environment
- This guide recommends GUI for easier learning
- Click Done
Installation Destination
- Select your virtual disk
- Choose "I will configure partitioning"
- Click Done
Manual Partitioning
- Click the "+" button to add partitions:
Boot Partition (
/boot):- Size: 1 GB
- Filesystem: ext4
- Purpose: Stores boot loader and kernel files
Swap Partition:
- Size: 2 GB (or equal to RAM for hibernation support)
- Filesystem: swap
- Purpose: Virtual memory extension
Root Partition (
/):- Size: Remaining space (minimum 17 GB)
- Filesystem: ext4
- Purpose: Main system and application storage
Click Done when partitioning is complete
Network and Host Name
- Enable network interface (toggle to ON)
- Set a meaningful hostname (e.g.,
centos-dev) - Click Apply
- Click Done
Security Policy
- For learning environments, you can disable security policy
- This simplifies password requirements during setup
- Click Done
Begin Installation
- Review all settings
- Click "Begin Installation"
- Installation proceeds automatically (5-15 minutes)
Root Password and User Creation
- While installation runs, set the root password
- Create a regular user account for daily use
- Use strong passwords even in learning environments
Completion
- Wait for installation to complete
- Click "Reboot" when prompted
- Remove installation media if necessary
- System restarts into your new Linux installation
First Boot and Initial Configuration
After rebooting:
License Information
- Accept the license agreement
- Click Done
User Login
- Enter your username and password
- Log into the system
Initial Updates
sudo yum update -yOr for newer versions:
sudo dnf update -y
Congratulations! You now have a fully functional Linux system ready for exploration and development.
Network Configuration Modes for Virtual Machines
Understanding network modes is crucial for effective virtual machine operation. Each mode serves different purposes and offers distinct advantages.
Bridged Mode
How It Works: The virtual machine receives an IP address from the same network as your host machine (e.g., host: 192.168.0.14, VM: 192.168.0.11).
Advantages:
- VM appears as a separate device on your network
- Full bidirectional communication with external systems
- Other devices can directly access the VM
Disadvantages:
- Risk of IP address conflicts with other network devices
- DHCP server may assign the same IP to multiple devices
- Less isolation from network threats
Best For: Servers that need to be accessible from other network devices
NAT Mode (Network Address Translation)
How It Works: The VM operates on a separate private network, accessing external networks through the host's connection.
Advantages:
- No IP address conflicts (VM uses private addressing)
- Good isolation from network threats
- VM can access external networks
Disadvantages:
- External devices cannot directly access the VM
- Additional NAT overhead (minimal performance impact)
- Port forwarding required for inbound connections
Best For: Development environments, learning, isolated testing
Host-Only Mode
How It Works: The VM can only communicate with the host machine—no external network access.
Advantages:
- Maximum isolation and security
- No risk of external network interference
- Fast communication with host
Disadvantages:
- No internet access
- Cannot communicate with other network devices
- Limited practical utility
Best For: Secure testing environments, malware analysis, isolated development
Virtual Machine Cloning: Efficient System Duplication
Once you've configured a Linux system to your satisfaction, cloning eliminates the need for repeated installations.
Method 1: Direct File Copy
Process:
- Shut down the virtual machine completely
- Navigate to the VM's storage directory
- Copy the entire VM folder to a new location
- In VMware: File → Open → Select the copied
.vmxfile - Power on the cloned VM
Advantages:
- Simple and straightforward
- No special tools required
- Works across different virtualization platforms
Considerations:
- May require MAC address regeneration
- Network settings might need adjustment
- Larger storage requirement
Method 2: VMware Clone Feature
Process:
- Ensure the VM is powered off (required)
- Right-click the VM in VMware library
- Select Manage → Clone
Follow the Clone Virtual Machine Wizard:
- Choose clone type (full or linked)
- Specify number of clones
- Set destination folder
- Complete the wizard
Full Clone: Independent copy with all data duplicated
Linked Clone: Shares base disk, saving space but dependent on original
Advantages:
- Automatic MAC address handling
- Clean system configuration
- Option for linked clones (space efficient)
Virtual Machine Snapshots: Time Travel for Your System
Snapshots preserve your VM's exact state at a specific moment, enabling instant rollback if experiments go wrong.
Creating Snapshots
- Ensure VM is running or suspended (not required to be off)
- Right-click the VM
- Select Snapshot → Take Snapshot
- Provide a descriptive name (e.g., "Before Apache Installation")
- Add optional description
- Click Take Snapshot
Restoring Snapshots
- Right-click the VM
- Select Snapshot → Snapshot Manager
- Browse the snapshot tree
- Select desired snapshot
- Click "Go To" to restore
- Confirm the restoration
Important Considerations:
- Snapshots are not backups (they depend on the original disk)
- Multiple snapshots can impact performance
- Delete unnecessary snapshots to save space
- Use snapshots for short-term state preservation, not long-term backup
VMware Tools: Enhanced Integration
VMware Tools significantly improves the virtual machine experience by enabling seamless integration between host and guest systems.
Benefits of VMware Tools
- Improved Graphics Performance: Better screen resolution and 3D acceleration
- Shared Folders: Easy file transfer between host and VM
- Clipboard Sharing: Copy-paste between host and guest
- Time Synchronization: Automatic clock alignment
- Graceful Shutdown: Proper VM shutdown from host
- Network Optimization: Enhanced network driver performance
Installation Steps
- Boot into CentOS and log in with root or sudo privileges
Initiate Installation
- In VMware menu: VM → Install VMware Tools
- A virtual CD-ROM appears in CentOS
Access the Installation Media
- Open the CD/DVD drive from the desktop
- Or access via
/run/media/or/mnt/
Copy Installation Package
# Create destination directory sudo mkdir -p /opt/vmware-tools # Copy the tarball cp /run/media/*/VMwareTools-*.tar.gz /opt/vmware-tools/Extract the Archive
cd /opt/vmware-tools tar -zxvf VMwareTools-*.tar.gzRun the Installer
cd vmware-tools-distrib sudo ./vmware-install.plAccept Defaults
- Press Enter to accept all default settings
- Installation completes automatically
Prerequisites
- GCC compiler must be installed
- If missing:
sudo yum install gcc make kernel-devel
Configuring Shared Folders
Host-Side Setup:
- Create a shared folder on host (e.g.,
D:\VMShare) - In VMware: VM → Settings → Options
- Select "Shared Folders"
- Choose "Always enabled"
- Add the folder path
- Click OK
Guest-Side Access:
- Shared folders appear in
/mnt/hgfs/ - Navigate:
cd /mnt/hgfs/ - Files are accessible from both host and guest
Note: In production environments, use secure file transfer methods (SCP, SFTP, rsync) instead of shared folders.
Linux Directory Structure: Everything Is a File
Linux employs a hierarchical tree-structured directory system. At the apex sits the root directory (/), from which all other directories branch. This unified structure contrasts sharply with Windows' drive-letter approach.
The fundamental philosophy: "Everything is a file"—hardware devices, processes, sockets, and even system information are represented as files.
Essential Directories Explained
/boot - System Boot Files
Purpose: Contains files required for system startup
Contents:
- Kernel images (
vmlinuz-*) - Initial RAM disk (
initrd-*) - Bootloader configuration (GRUB)
- System map files
Important: Never delete files from /boot unless you understand the consequences.
/dev - Device Files
Purpose: Hardware device representation
Contents:
- Disk drives (
/dev/sda,/dev/nvme0n1) - Terminal devices (
/dev/tty*,/dev/pts/*) - Random number generators (
/dev/random,/dev/urandom) - Null device (
/dev/null)
Concept: Hardware devices are accessed through file operations.
/bin - Essential User Binaries
Purpose: Critical command executables
Contents:
- Basic commands (
ls,cp,mv,rm) - Shell interpreters (
bash,sh) - File utilities (
cat,echo,grep)
Note: Required for single-user mode operation.
/sbin - System Binaries
Purpose: System administration commands
Contents:
- Network configuration (
ifconfig,ip) - Disk management (
fdisk,mkfs) - System control (
reboot,shutdown)
Access: Typically requires root or sudo privileges.
/home - User Home Directories
Purpose: Personal directories for regular users
Structure: /home/username/
Contents:
- User documents and files
- Application configurations (hidden
.*files) - Desktop environment settings
Note: Each user has their own isolated home directory.
/root - Root User Home
Purpose: Home directory for the superuser
Distinction: Separate from /home/root (which doesn't exist)
Contents: Root user's personal files and configurations
/lib - System Libraries
Purpose: Shared libraries for system binaries
Contents:
- Dynamic link libraries (
.sofiles) - Kernel modules
- Firmware files
Analogy: Similar to Windows DLL files.
/lost+found - Recovery Directory
Purpose: Stores recovered files after system crashes
Normal State: Empty or contains few files
After Crash: Filesystem check places recovered fragments here
/etc - Configuration Files
Purpose: System-wide configuration
Contents:
- Service configurations (
/etc/httpd/,/etc/mysql/) - User account information (
/etc/passwd,/etc/shadow) - Network settings (
/etc/hosts,/etc/resolv.conf) - Startup scripts
Critical: Backup before modifying configuration files.
/usr - User Programs and Data
Purpose: Secondary hierarchy for user applications
Subdirectories:
/usr/bin: User command binaries/usr/lib: Library files/usr/local: Locally installed software/usr/share: Architecture-independent data/usr/src: Source code
Analogy: Similar to Windows' "Program Files"
/proc - Process Information (Virtual)
Purpose: Kernel and process information interface
Nature: Virtual filesystem (exists in memory, not disk)
Contents:
- Process information (
/proc/[pid]/) - System information (
/proc/cpuinfo,/proc/meminfo) - Kernel parameters (
/proc/sys/)
Warning: Do not modify files in /proc unless you understand the implications.
/srv - Service Data
Purpose: Data for services provided by the system
Contents:
- Web server content (sometimes)
- FTP server files
- Other service-specific data
Usage: Varies by distribution and configuration.
/sys - System Information (Virtual)
Purpose: Kernel device and driver information
Nature: Virtual filesystem (sysfs)
Contents:
- Device information
- Driver configurations
- Power management settings
Warning: Like /proc, modifications can affect system stability.
/tmp - Temporary Files
Purpose: Temporary file storage
Characteristics:
- Cleared on system reboot (typically)
- Available to all users
- Often mounted as tmpfs (RAM-based)
Best Practice: Don't store important data in /tmp.
/media - Removable Media Mount Points
Purpose: Automatic mount points for removable devices
Contents:
- USB drives
- CD/DVD drives
- External hard drives
Behavior: Automatically created when devices are connected.
/mnt - Manual Mount Point
Purpose: Temporary filesystem mounting
Usage:
- Mount network shares
- Temporary disk access
- Manual device mounting
Convention: Create subdirectories for specific mounts (/mnt/usb, /mnt/backup).
/opt - Optional Software
Purpose: Third-party and add-on software
Contents:
- Commercial applications
- Large software packages
- Self-contained applications
Convention: Each application in its own subdirectory (/opt/oracle, /opt/google).
/var - Variable Data
Purpose: Frequently changing data
Contents:
- Log files (
/var/log/) - Mail queues (
/var/mail/) - Print queues (
/var/spool/) - Website content (
/var/www/) - Cache files (
/var/cache/)
Important: Monitor disk usage—/var can grow significantly.
/selinux - Security-Enhanced Linux
Purpose: SELinux security subsystem
Function: Mandatory access control system
Modes:
- Enforcing: Security policies actively enforced
- Permissive: Policies logged but not enforced
- Disabled: SELinux turned off
Configuration: Managed through /etc/selinux/config
Conclusion: Building Your Linux Foundation
This guide has covered the essential foundations of Linux system installation and directory structure. You've learned how to:
- Set up a Linux virtual machine safely
- Configure network connectivity appropriately
- Install and configure VMware Tools for enhanced integration
- Navigate the hierarchical directory structure
- Understand the purpose of each critical directory
Linux mastery begins with these fundamentals. As you continue your journey, you'll discover that this initial investment in understanding pays continuous dividends. The directory structure becomes second nature, command-line operations become intuitive, and the power of Linux becomes an extension of your own capabilities.
Remember: the best way to learn Linux is by using it. Experiment in your virtual machine, break things, fix them, and gradually build confidence. Every system administrator and developer started exactly where you are now—with curiosity and a willingness to learn.
Welcome to the Linux community. Your journey has just begun.