Deploying Linux servers in a virtualized environment requires precise configuration and optimization. This article details the entire process of Linux installation in a VMware environment, covering key steps from virtual machine creation to production environment tuning, and is suitable for system administrators with experience in using ESXi or Workstation.
1. Environment preparation and resource planning
Hardware requirements: CPU with at least 2 cores (vCPU), hardware virtualization (Intel VTx/AMDV) is recommended; minimum memory of 1GB (basic system), ≥4GB for production environment; storage system disk ≥20GB (Thin Provisioning is recommended to save space); network bridge mode or NAT (select according to network topology).
Software resources Get the official ISO image (taking RHEL 9.2 as an example):
wget https://mirror.rackspace.com/centos/9.2/isos/x86_64/CentOSStream9latestx86_64dvd1.iso
Verify SHA256 integrity:
echo "a1b2c3d4e5f6... CentOSStream9.iso" | sha256sum c
II. Key parameters for virtual machine creation
Configuration steps: Select "Custom (Advanced)" configuration type for a new virtual machine, and compatibility with ESXi 7.0 U3 or Workstation 17.x. Client operating system: Linux version Red Hat Enterprise Linux 9 64-bit, firmware UEFI (instead of traditional BIOS).
CPU settings plaintext; 1 virtual slot, 4 cores per slot; check "Virtual Intel VTx/EPT" for virtualization engine; memory allocation 4096 MB (enable to reserve all memory); network adapter VMXNET3 (high performance) uses bridge mode (directly obtain physical network IP). Disk configuration:
plaintext
The controller type is Paravirtual SCSI, the disk type used is thin provisioning capacity 40 GB, and the virtual device node can be set to SCSI (0:0).
3. Linux system installation process
To start the installation, mount the ISO to the virtual optical drive, start the virtual machine to enter the installation interface. Partition scheme (manual configuration):
plaintext
/boot: 1GB (XFS)
/: 30GB (XFS
swap: 1.5 times the memory (8GB)
/var/log: remaining space (XFS)
Use LVM volume group for later expansion.
Network configuration:
# View the network card name (usually ens192)
ip addr show
# Static IP configuration example
nmcli con mod ens192 ipv4.addresses 192.168.1.100/24
nmcli con mod ens192 ipv4.gateway 192.168.1.1
nmcli con mod ens192 ipv4.dns "8.8.8.8 1.1.1.1"
nmcli con mod ens192 ipv4.method manual
nmcli con up ens192
Security hardening requires enabling SELinux enforcing mode, firewall configuration:
sudo firewallcmd permanent addservice=ssh
sudo firewallcmd permanent addport=80/tcp
sudo firewallcmd reload
IV. VMware Tools integration
The open source alternative is to install Open VM Tools (recommended)
# RHEL/CentOS
sudo dnf install openvmtools
sudo systemctl enable now vmtoolsd
# Ubuntu/Debian
sudo apt install openvmtools
sudo systemctl start openvmtools
Function verification:
# Check service status
systemctl status vmtoolsd
# Test host virtual machine time synchronization
vmwaretoolboxcmd timesync enable
The core functions include three major parts: host and client clipboard sharing, dynamic resolution adjustment, and virtual machine heartbeat detection.
V. Performance optimization configuration
VMX configuration adjustment (.vmx file):
properties
monitor_control.restrict_backdoor = "true" # Security enhancement
isolation.tools.copy.disable = "false" # Enable copy and paste
isolation.tools.paste.disable = "false"
sched.mem.pshare.enable = "FALSE" # Disable memory page sharing
Kernel parameter optimization (/etc/sysctl.conf):
conf
vm.swappiness = 10 # Reduce swap tendency
vm.dirty_ratio = 15 # Write back memory threshold
vm.dirty_background_ratio = 5 # Background write back threshold
net.core.rmem_max = 16777216 # Network buffer
net.core.wmem_max = 16777216
Disk I/O scheduling:
# Permanently enable the deadline scheduler
echo 'ACTION=="add|change", KERNEL=="sd", ATTR{queue/scheduler}="deadline"' > /etc/udev/rules.d/60scheduler.rules
Six, backup and snapshot management
Automated snapshot strategy:
# Create a snapshot through ESXi CLI
vimcmd vmsvc/getallvms | grep <VMID>
vimcmd vmsvc/snapshot.create <VMID> "NightlyBackup" "Daily snapshot" 1 0
Backup best practices Apply consistent backup: Freeze the file system before snapshot
fsfreeze f /data # Freeze mount point
# Create snapshot
fsfreeze u /data # Thaw
Export using OVF template:
ovftool vi://user@esxihost/VMname /backup/vmbackup.ovf
Seven, troubleshooting and diagnosis
Solutions to common problems, such as network connection failure:
# Reset VMware network adapter
sudo service networkmanager restart
sudo dhclient v ens192
No response from the console:
# Force restart VMware tools
sudo systemctl restart vmtoolsd
Insufficient disk space: Execute after expanding the virtual disk:
sudo growpart /dev/sda 1
sudo xfs_growfs /
Log collection:
# Export VMware logs
vmsupport w /tmp/vmlogs.zip
# Analyze system logs
journalctl b p 3 since "1 hour ago"
VIII. Production environment deployment recommendations
Resource reservation is mainly 50% CPU reservation to ensure computing resources, while 100% memory reservation to avoid swapping. The storage policy is to use enterprise-level SSD RAID10 arrays. Enable vSAN to achieve cross-host storage redundancy. The security baseline needs to be updated regularly:
sudo dnf update security
Disable root SSH login:
conf
# /etc/ssh/sshd_config
PermitRootLogin no
PasswordAuthentication no
By following this guide, you can build a high-performance Linux server in a VMware environment. After the installation is complete, execute sudo tunedadm profile virtualhost to enable the virtual machine optimization profile, and verify the tool integration status through vmwaretoolboxcmd stat. Use esxtop to monitor resource utilization regularly to ensure the stable operation of the virtualization environment.