Linux Fundamentals: Complete Guide to System Installation and Directory Structure
Understanding Linux: The Foundation of Modern Computing
Linux has evolved from a hobbyist operating system into the backbone of modern digital infrastructure. This open-source, free operating system has earned universal recognition for its stability, security, and exceptional multi-concurrent processing capabilities. Today, virtually every enterprise-level project—whether built with C/C++, PHP, Python, Java, or Go—finds its deployment home on Linux or Unix-based systems.
The Linux ecosystem encompasses numerous distributions, each tailored to specific use cases and user preferences. The major distributions include Ubuntu (known for user-friendliness), RedHat (enterprise-focused), CentOS (stable server platform), Debian (universal operating system), Fedora (cutting-edge features), SuSE, and OpenSUSE. It's important to understand that "Linux" technically refers to the kernel itself, while distributions represent complete operating system packages built around this kernel with additional software, package managers, and configuration tools.
Preparing for Linux Installation
Virtualization Prerequisites
Before installing Linux, you need to create a virtual machine environment. This approach offers several advantages: isolation from your host system, easy backup and restoration, and the ability to experiment without risk to your primary operating system.
Step 1: Install Virtualization Software
Begin by installing VMware Workstation (version 15.5 or later recommended) or an alternative like VirtualBox. These applications create the virtual hardware environment where Linux will run.
Step 2: Verify Virtualization Support
Before proceeding, ensure your system supports hardware virtualization. Open Task Manager, navigate to the Performance tab, select CPU, and check if virtualization is enabled. If virtualization is disabled, you'll need to enter your system BIOS during boot and enable Intel VT-x or AMD-V features. This step is critical—without hardware virtualization support, virtual machines will either fail to start or perform extremely poorly.
Step 3: Download Linux Distribution
For this guide, we'll use CentOS 7.6 or CentOS 8.1, both excellent choices for learning and production use. Download the ISO image from the official CentOS website or trusted mirrors.
Creating the Virtual Machine
Launch VMware and select "Create a New Virtual Machine." Choose the "Custom (advanced)" option for greater control over hardware configuration.
Hardware Configuration:
- Processors: Allocate 2 CPUs with 2 cores each. This provides sufficient processing power for most development and learning scenarios without overcommitting host resources.
- Memory: Assign 2-4 GB RAM depending on your host system's capacity.
- Storage: Create a virtual disk of at least 20 GB. Choose "Split virtual disk into multiple files" for easier portability.
- Network Adapter: Initially set to NAT mode (explained in detail below).
Installation Configuration:
When the virtual machine boots from the CentOS ISO:
- Language Selection: Choose your preferred language. For learning purposes, English is recommended as most documentation and troubleshooting resources use English terminology.
- Software Selection: For enterprise production environments, "Minimal Install" is typical, reducing attack surface and resource consumption. For learning purposes, select "GNOME Desktop" or "KDE Plasma" to have a graphical interface that makes initial exploration more intuitive.
- Installation Destination: Select "I will configure partitioning" and click Done. This manual partitioning approach provides better understanding of Linux filesystem organization.
Partition Scheme:
Click the "+" button to create partitions manually:
- /boot: 1 GB, ext4 filesystem. Contains boot loader files and kernel images.
- swap: 2 GB, swap filesystem. Virtual memory extension, particularly important for systems with limited RAM.
- / (root): Remaining space (minimum 17 GB), ext4 filesystem. The main filesystem containing the operating system and applications.
- Network and Hostname: Configure your network settings and assign a meaningful hostname. This identifier will be used for network communication and system identification.
- Security Policy: For learning environments, you may disable security policies like SELinux to reduce complexity. In production, these should be carefully configured.
- User Configuration: Create a regular user account with a strong password. You'll also set the root password during installation.
After configuration completes, click "Begin Installation." The process typically takes 10-20 minutes depending on your system and selected options. Once complete, reboot the virtual machine and log in with your credentials.
Network Configuration Modes Explained
Understanding network configuration is crucial for effective Linux usage. VMware provides three primary networking modes, each serving different purposes:
Bridged Mode
In bridged networking, the virtual machine receives an IP address from the same network as your host system. If your host has IP 192.168.0.14, the VM might receive 192.168.0.11. Both addresses exist on the same network segment.
Advantages:
- The VM appears as a separate device on your network
- Other devices can directly communicate with the VM
- Ideal for servers that need network accessibility
Disadvantages:
- Risk of IP address conflicts with other network devices
- Your network's DHCP server must have available addresses
- Less isolation from network-based threats
NAT Mode (Network Address Translation)
NAT mode creates a private network between your host and virtual machines. The VM accesses external networks through your host's connection, but external devices cannot directly initiate connections to the VM.
Advantages:
- No IP address conflicts—the VM uses a private network segment
- Multiple VMs can run simultaneously without network configuration issues
- Good isolation from network threats
Disadvantages:
- Other devices cannot directly access services running on the VM
- Requires port forwarding configuration for server applications
- Slightly more complex network troubleshooting
Host-Only Mode
Host-only networking creates a completely isolated network between the host and VMs. No external network access is available.
Use Cases:
- Isolated testing environments
- Security-sensitive development
- Network simulation and experimentation
Recommendation for Learners: Start with NAT mode. It provides internet access for package installation and updates while maintaining reasonable isolation. Switch to bridged mode when you need the VM to function as a network-accessible server.
Virtual Machine Cloning
Once you have a properly configured Linux system, cloning allows you to create copies without repeating the entire installation process. This is invaluable for creating test environments, student labs, or backup configurations.
Method 1: Manual Copy
Simply copy the entire virtual machine folder to a new location. To use the copy:
- Open VMware
- Select File → Open
- Navigate to the copied folder and select the
.vmxconfiguration file
This method is straightforward and allows easy sharing of complete VM configurations with colleagues. Send them the folder, and they have an identical system ready to run.
Method 2: VMware Clone Feature
VMware includes a built-in cloning wizard:
- Important: Shut down the Linux system completely before cloning
- Right-click the virtual machine in VMware's library
- Select Manage → Clone
Follow the wizard, choosing between:
- Linked Clone: Shares base disk, uses less space but depends on original
- Full Clone: Completely independent copy, uses more space
Linked clones are space-efficient for testing scenarios. Full clones are better for production copies or when the original might be deleted.
Virtual Machine Snapshots
Snapshots capture the complete state of a virtual machine at a specific moment, including disk contents, memory state, and device settings. This feature is invaluable for:
- Testing risky operations (system updates, configuration changes)
- Creating restore points before major modifications
- Learning through experimentation without permanent consequences
Creating a Snapshot
- With the VM running or stopped, right-click in VMware
- Select Snapshot → Take Snapshot
- Provide a descriptive name and optional description
- Click Take
Example names: "Clean Install," "Before Apache Installation," "Post-Update."
Restoring a Snapshot
- Right-click the VM
- Select Snapshot → Snapshot Manager
- Select the desired snapshot from the list
- Click "Go To" to restore
The VM will return to exactly the state it was in when the snapshot was created. This is far more comprehensive than file backups—it includes running processes, memory contents, and system configuration.
Best Practice: Create snapshots before:
- Installing new software
- Applying system updates
- Modifying critical configuration files
- Experimenting with unfamiliar commands
Installing VMware Tools
VMware Tools is a suite of utilities that enhances virtual machine performance and usability. The benefits are substantial:
- Improved graphics performance and resolution support
- Shared clipboard between host and guest
- Shared folder capability
- Better mouse integration (no need to "capture" and "release" the cursor)
- Time synchronization between host and VM
- Graceful shutdown support
Installation Steps
- Boot the CentOS VM and log in with root or sudo privileges
- Initiate Tools Installation: In VMware menu, select Virtual Machine → Install VMware Tools
- Mount the Installation Media: CentOS will automatically mount a virtual CD containing the VMware Tools installer. Access it through the file manager or terminal.
Copy to Installation Directory: Copy the
.tar.gzarchive to/opt:cd /opt # Use file manager: Home → Other Locations → Computer → opt # Or copy from the mounted CDExtract the Archive:
cd /opt tar -zxvf VMwareTools-*.tar.gzRun the Installer:
cd vmware-tools-distrib ./vmware-install.pl- Accept Defaults: The installer will prompt for various configuration options. Pressing Enter to accept defaults works well for most scenarios.
Prerequisites: Ensure GCC (GNU Compiler Collection) is installed. If not, install it first:
sudo yum install gcc make kernel-devel
Configuring Shared Folders
Shared folders enable seamless file exchange between host and guest systems:
- Create a Host Folder: For example, create
D:\VMShareon Windows Configure VMware:
- Virtual Machine → Settings → Options tab
- Select Shared Folders
- Choose "Always enabled"
- Click Add and select your host folder
- Complete the wizard
Access in Linux: The shared folder appears at
/mnt/hgfs/. You may need to restart the VM or run:sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other
This enables bidirectional file sharing—files placed in the host folder appear in the VM and vice versa. While convenient for development, remember that production file transfers typically use secure protocols like SCP or SFTP.
Linux Directory Structure: Everything Is a File
Linux employs a hierarchical tree-structured directory system. At the top sits the root directory, denoted by /. All other directories branch from this single root, creating a unified filesystem regardless of how many physical disks or partitions exist.
The philosophy "everything is a file" permeates Linux design. Hardware devices, system information, processes—all are represented as files within this hierarchy. Understanding this structure is fundamental to Linux proficiency.
Critical Directories Explained
/boot - System Boot Files
Contains files essential for system startup: boot loader configuration, kernel images, and initial ramdisk. Modifying files here can render your system unbootable—exercise caution.
/dev - Device Files
Analogous to Windows Device Manager, this directory contains file representations of all hardware devices. Your hard drive might appear as /dev/sda, a USB drive as /dev/sdb1, and terminals as /dev/tty. This abstraction allows programs to interact with hardware using standard file operations.
/bin - Essential Binaries
Houses fundamental command-line utilities needed for basic system operation: ls, cp, mv, cat, bash, etc. These commands are available even in single-user mode for system recovery.
/sbin - System Binaries
The "s" stands for "super user." This directory contains system administration commands: fdisk, ifconfig, reboot, shutdown. Many commands here require root privileges.
/home - User Home Directories
Each regular user receives a subdirectory here. For user "john," the home directory is /home/john. This is where users store personal files, configurations, and data. User-specific application settings typically reside in hidden directories (prefixed with .) within the home folder.
/root - Root User Home
The home directory for the superuser (root). Separate from /home/root to emphasize its special status and ensure accessibility even if /home is on a separate partition that fails to mount.
/lib - System Libraries
Contains shared libraries (similar to Windows DLLs) required by programs in /bin and /sbin. These include the C library, kernel modules, and firmware. The system cannot boot without these libraries.
/lost+found - Recovery Directory
Normally empty. When the system experiences an improper shutdown or filesystem corruption, recovered file fragments may appear here after filesystem checks (fsck).
/etc - Configuration Files
The central repository for system-wide configuration files. Network settings (/etc/network/), user account information (/etc/passwd), service configurations (/etc/mysql/, /etc/nginx/) all reside here. The name reportedly comes from "et cetera," though it now stands as a backronym for "Editable Text Configuration."
/usr - User System Resources
One of the most important directories, analogous to Windows' "Program Files." Contains user applications, libraries, documentation, and source code. Subdirectories include:
/usr/bin- User command binaries/usr/lib- User program libraries/usr/local- Locally installed software/usr/share- Architecture-independent data
/proc - Process Information (Do Not Modify)
A virtual filesystem providing a window into kernel and process information. Files here don't exist on disk—they're generated on-the-fly when accessed. Contains system information like /proc/cpuinfo, /proc/meminfo, and per-process directories. Never attempt to store files here.
/srv - Service Data (Do Not Modify)
Contains data served by system services. For example, a web server might serve files from /srv/www, and FTP files from /srv/ftp. This separation keeps service data distinct from user data.
/sys - System Information (Do Not Modify)
Similar to /proc, but specifically for device and driver information. Introduced with Linux 2.6 kernel, it provides structured access to kernel device models. Never store files here.
/tmp - Temporary Files
A location for temporary file storage. Files here may be deleted upon system reboot. Many applications use this directory for lock files, sockets, and temporary data. Some systems automatically clean files older than a certain age.
/media - Removable Media Mount Points
Linux automatically mounts removable devices (USB drives, CDs, DVDs) under this directory. You'll see subdirectories like /media/usb or /media/cdrom when devices are connected.
/mnt - Manual Mount Points
Intended for temporarily mounting filesystems manually. System administrators might mount network shares, additional hard drives, or disk images here. The distinction from /media is that /media is for automatic mounting while /mnt is for manual mounting.
/opt - Optional Software
Designed for add-on application software. By convention, commercial or third-party applications that aren't part of the distribution's package management install here. Oracle Database, Google Chrome, and similar applications often use /opt. The directory is typically empty on fresh installations.
/usr/local - Locally Compiled Software
Another location for additional software, traditionally used for programs compiled from source. This keeps locally installed software separate from distribution-managed packages in /usr.
/var - Variable Data
Contains files that change frequently during system operation:
/var/log- System and application log files/var/www- Web server content (traditional location)/var/mail- User mailboxes/var/spool- Print queues, scheduled tasks/var/cache- Application cache data
The name "var" stands for "variable," reflecting the dynamic nature of contents.
/selinux - Security-Enhanced Linux
Contains SELinux policy files and configuration. SELinux is a security subsystem that implements mandatory access controls, restricting programs to accessing only specific files. It operates in three modes: enforcing (blocks violations), permissive (logs violations), and disabled. Configuration requires careful planning as overly restrictive policies can break applications.
Best Practices for Linux Learners
- Start with Virtual Machines: Experiment freely without risking your primary system. Snapshots enable risk-free exploration.
- Learn the Command Line: While graphical interfaces are convenient, command-line proficiency unlocks Linux's true power.
- Understand Permissions: Linux file permissions (
chmod,chown) are fundamental to security and proper operation. - Read Documentation: Man pages (
man command) and/usr/share/doccontain invaluable information. - Practice Regularly: Linux proficiency comes from consistent use. Set up small projects to apply what you learn.
- Join Communities: Forums, Reddit's r/linux4noobs, and local user groups provide support and learning opportunities.
Conclusion
Linux installation and directory structure understanding form the foundation of Linux proficiency. By following this guide, you've learned how to set up a Linux virtual machine, configure networking, leverage VMware features for efficient management, and navigate the filesystem hierarchy.
Remember that Linux mastery is a journey, not a destination. Start with these fundamentals, experiment safely in virtual machines, and gradually expand your knowledge. The skills you develop will serve you well whether you're managing servers, developing applications, or exploring new technologies.
The directory structure may seem overwhelming initially, but with regular use, the organization becomes intuitive. Each directory serves a specific purpose, and understanding these purposes helps you know where to find files, where to place your own files, and how to troubleshoot issues effectively.
Welcome to the Linux community—a world of open-source collaboration, powerful tools, and endless learning opportunities.