Hyper-VVirtualizaciónVMs8 min de lectura

Instalar y configurar Hyper-V

Habilitá Hyper-V en tu VPS Windows para crear y gestionar máquinas virtuales.


Hyper-V te permite crear máquinas virtuales dentro de tu VPS Windows Server para aislar servicios o probar configuraciones.

Paso 1 — Instalar el rol Hyper-V

powershell
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart

El servidor se reinicia automáticamente.

Paso 2 — Verificar instalación

powershell
Get-WindowsFeature Hyper-V
Get-Command -Module Hyper-V | Measure-Object

Paso 3 — Crear un switch virtual

powershell
# Switch interno (comunicación entre VMs)
New-VMSwitch -Name "SwitchInterno" -SwitchType Internal

# Switch externo (acceso a internet)
New-VMSwitch -Name "SwitchExterno" -NetAdapterName "Ethernet" -AllowManagementOS $true

Paso 4 — Crear una máquina virtual

powershell
# Crear VM con 2 GB RAM y disco de 40 GB
New-VM -Name "VM-Ubuntu" -MemoryStartupBytes 2GB -Generation 2 -NewVHDPath "C:\VMs\VM-Ubuntu.vhdx" -NewVHDSizeBytes 40GB -SwitchName "SwitchExterno"

Paso 5 — Configurar la VM

powershell
# Asignar procesadores
Set-VMProcessor -VMName "VM-Ubuntu" -Count 2

# Configurar memoria dinámica
Set-VMMemory -VMName "VM-Ubuntu" -DynamicMemoryEnabled $true -MinimumBytes 1GB -MaximumBytes 4GB

# Montar ISO de instalación
Add-VMDvdDrive -VMName "VM-Ubuntu" -Path "C:\ISOs\ubuntu-22.04-server.iso"

# Configurar orden de boot
Set-VMFirmware -VMName "VM-Ubuntu" -FirstBootDevice (Get-VMDvdDrive -VMName "VM-Ubuntu")

Paso 6 — Gestionar VMs

powershell
# Iniciar VM
Start-VM -Name "VM-Ubuntu"

# Detener VM
Stop-VM -Name "VM-Ubuntu"

# Listar todas las VMs
Get-VM | Format-Table Name, State, CPUUsage, MemoryAssigned

# Conectar a la consola
vmconnect.exe localhost "VM-Ubuntu"

Paso 7 — Snapshots (checkpoints)

powershell
# Crear snapshot
Checkpoint-VM -Name "VM-Ubuntu" -SnapshotName "Pre-actualización"

# Listar snapshots
Get-VMSnapshot -VMName "VM-Ubuntu"

# Restaurar snapshot
Restore-VMSnapshot -VMName "VM-Ubuntu" -Name "Pre-actualización" -Confirm:$false

# Eliminar snapshot
Remove-VMSnapshot -VMName "VM-Ubuntu" -Name "Pre-actualización"

Paso 8 — Exportar e importar VMs

powershell
# Exportar
Export-VM -Name "VM-Ubuntu" -Path "E:\Exports"

# Importar
Import-VM -Path "E:\Exports\VM-Ubuntu\Virtual Machines\vm.vmcx" -Copy -GenerateNewId

Hyper-V en tu VPS de Baires Host te permite virtualizar servicios adicionales con aislamiento completo.


¿Te resultó útil esta guía?