在 CentOS 8 中使用 KVM 安裝 Windows 10
阿新 • • 發佈:2020-11-24
使用 esxi 的話總覺得有些彆扭?故嘗試 KVM,本文使用 CentOS 8 minimal 作為基礎環境。因為懶得截圖,所以就決定不上圖了。
使用阿里雲映象
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
yum makecache
安裝 cockpit 和 qemu
dnf install cockpit cockpit-machines
啟用 cockpit
systemctl enable --now cockpit.socket
安裝 Winodws 依賴的驅動
dnf install virtio-win
配置虛擬機器網路
略
建立 Windows 虛擬機器並配置 CDROM
隨便使用一個 Windows ISO 都可以,系統裡沒有 Windows,隨便選擇一個都可以,我在這裡選的是 Fedora 31,建立完系統後不要開機,緊接著需要掛載驅動 ISO 為 CDROM。
掛載 CDROM 在 cockpit 網頁端並不支援,詳見Option to add/remove CD-ROM device and load/eject ISO
需要手動編輯,假設建立的虛擬機器名稱為 win10,則可以通過執行virsh edit win10
來進行編輯。
在<disk>
標籤所在的組中新增一個<disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/usr/share/virtio-win/virtio-win.iso'/>
<backingStore/>
<target dev='sda' bus='sata'/>
<readonly/>
<alias name='sata-cdrom'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
安裝 Windows
到了選擇磁碟的那一步會發現沒有磁碟可選,這個時候需要安裝我們掛載的驅動,64 位的話選擇 amd64/win10 就 OK 了。