Home System Tutorial LINUX Guide to Configuring and Installing Windows Operating Systems in KVM for Ubuntu

Guide to Configuring and Installing Windows Operating Systems in KVM for Ubuntu

Dec 31, 2023 am 09:57 AM
windows ubuntu kvm

Guide to Configuring and Installing Windows Operating Systems in KVM for Ubuntu

Why bother with KVM virtual machine

Recently, due to company affairs, I don’t have much time to write, so I will use a technical article to make up for it.

The thing is like this, our company has a small thing that is developed based on an embedded system and does not belong to the Android or iOS platform. Well, what does this mean? This means that the language for developing this little thing is C language, not Java, Objective-C or Swift. So we need a Cross Compiler, also known as a cross-compilation environment, to compile this code.

In fact, the iOS App compiled by Xcode also belongs to the category of cross-compilation.

However, this cross-compilation environment is only for Windows platform! In fact, it seems that apart from GCC, the most useful cross-compilation environments are those under Windows. It is estimated that many students who play embedded systems should know that the Keil and IAR series are commonly used in the industry now. Unfortunately, both are Windows-specific and there are no macOS or Linux versions.

Why does Windows make me so unhappy? Because usually in order to better improve work efficiency, except when the industry application software that we have to use must run under Windows, we only use Mac instead of Windows. So, we basically don’t have idle and wealthy Windows hosts, no! There is no such thing at all. There is no such thing as "basically no".

On the server side, don’t even talk to me about Windows Server. As a crazy user of macOS and Ubuntu, it is impossible for me to run a Windows Server on Bare metal. We only run Linux on the server and are not interested in anything else.

Then the question is, we have an automated compilation system, which is also known as CI system (Continuous integration), using Atlassian's family bucket: Bitbucket, Bamboo, JIRA and Confluence, etc., all running on In a Docker virtualization container on the Linux platform.

Now we want to automate the compiler for this little thing, so as to better release manpower and make it easier to track and manage the content of each Release in the future. The first problem to solve is: we do not have a Windows server.

Since virtualization is so popular now, let’s use the existing Ubuntu server to virtualize a Windows. Okay, let’s go!

What is KVM

The full name of KVM is: Kernel-based Virtual Machine. In a simple sentence, it is a virtualization management system based on the Linux kernel.

This feature has been integrated since Linux kernel version 2.6.20. Simply understand that Docker is virtualization at the application layer, while KVM is virtualization at the system layer.

The difference is that the content of Docker virtualization must share the kernel with the Host host, which means that it can only run Linux-type systems.

KVM virtualizes the entire host, so it can install different operating systems and is not limited to Linux itself. When I have a fit later, I'll see if I can virtualize macOS on Ubuntu. In this way, there is no need to get a separate Mac host to automatically compile the iOS App.

Install KVM

I am using the Ubuntu 16.04 LTS version here. Considering long-term use and stability, I basically only choose the LTS version. The other versions are not much different, so just refer to it.

The first step is to install the KVM-related package files. Because my server is all command line and the X desktop is not installed, I added the --no-install-recommends parameter. Otherwise it will install packages like virt-viewer, which have X11 and many graphics libraries among their dependencies, none of which are needed. But if you enable the desktop system, you do not need to add this parameter.

$ sudo apt-get install --no-install-recommends qemu-kvm qemu-utils libvirt-bin virtinst cpu-checker

Let’s verify if everything is OK

$ kvm-ok

INFO: /dev/kvm exists

KVM acceleration can be used

Very good, everything goes well, let's get another bridge network. In fact, this is not necessary, it depends on your usage scenario.

KVM will create a virbr0 bridge network by itself, but this is a NAT network and there is no way to communicate with other hosts in the LAN, so don’t be lazy and build a bridge network yourself.

The reference configuration is as follows:

$ cat /etc/network/interfaces

# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface

auto lo

iface lo inet loopback

# The bridged network interface

auto br0

iface br0 inet static

address 1.2.3.4

netmask 255.255.255.0

gateway 1.2.3.1

dns-nameservers 1.2.3.1

bridge_ports enp9s0

bridge_stop off

bridge_fd 0

bridge_maxwait 0

Restart the network and verify the bridge status:

$ sudo systemctl restart networking

$ sudo brctl show

bridge name bridge id STP enabled interfaces

br0 8000.f079593874d9 no enp9s0

virbr0 8000.525400087ef2 yes virbr0-nic

OK, everything is normal and you can start creating a virtual host.

Create virtual host

KVM has only completed the first step, we still need to create a virtual host before we can continue.

Before we start, we need to prepare a few things:

1.Windows installation image

2.Virtio ISO and floppy disk image

3.VNC client (included with macOS)

I am using Virtio 0.1.126-2 version here. The operating system version is: Ubuntu 16.04.1 LTS.

Everything is ready, use the virt-install command to help create a virtual machine:

virt-install \

--name win10 \

--memory 2048 \

--vcpus sockets=1,cores=1,threads=2 \

--cdrom=/path/to/windows_10.iso \

--os-variant=win8.1 \

--disk /path/to/win10/win10.qcow2,bus=virtio,size=40 \

--disk /path/to/virtio/virtio-win-0.1.126_amd64.vfd,device=floppy \

--network bridge=br0,model=virtio \

--graphics vnc,password=Passw0rd,port=5910 \

--hvm \

--virt-type kvm

Basically the configuration information is all above, the virtual information machine configuration is as follows:

2G memory

1 CPU, 1 core, 2 threads

1 CDROM (Windows installation disc)

40G hard disk (system disk)

1 floppy drive (Virtio driver)

Open a VNC remote desktop on port 5910

If you enter the command correctly, you should get a similar feedback message:

Starting install...

Creating domain...

Domain installation still in progress. Waiting for installation to complete.

To put it simply, the virtual machine has been created, but because there is no graphical interface, there is no way to proceed. Once we have VNC connected, we can continue. This prompt will only appear once. After the system is installed, this startup waiting situation will not occur.

Install Windows 10

Although when we created the virtual machine, we specified the use of port 5910 to provide VNC remote desktop. However, this port cannot be accessed directly because it is bound to 127.0.0.1 by default, which means it can only be accessed locally. We need to first map the remote local port to the local port.

ssh -L 5910:127.0.0.1:5910 server

Then under macOS, ⌘ Space calls out Spotlight, and then enter:

vnc://127.0.0.1:5910

Enter the password in the pop-up window: Passw0rd

Then you can happily install the Windows system. If the hard disk cannot be recognized, you need to manually load the driver and select drive A and the corresponding Windows directory. Similarly, if the network card does not have a driver, the same method applies.

Attached is a screenshot of the installation completion:

Guide to Configuring and Installing Windows Operating Systems in KVM for Ubuntu

The above is the detailed content of Guide to Configuring and Installing Windows Operating Systems in KVM for Ubuntu. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Lossless Scaling on Steam Deck OLED runs games at up to 2x FPS Lossless Scaling on Steam Deck OLED runs games at up to 2x FPS Aug 26, 2024 am 10:07 AM

ETA Prime recently showcased a paid software called Lossless Scaling on ROG Ally X. While it doesn't actually improve the actual gaming performance, the software enhances the experience by adding frame generation and resolution scaling. These two can

Android TV Box gets unofficial Ubuntu 24.04 upgrade Android TV Box gets unofficial Ubuntu 24.04 upgrade Sep 05, 2024 am 06:33 AM

For many users, hacking an Android TV box sounds daunting. However, developer Murray R. Van Luyn faced the challenge of looking for suitable alternatives to the Raspberry Pi during the Broadcom chip shortage. His collaborative efforts with the Armbia

How to update the latest version of Bybit Exchange? Will there be any impact if it is not updated? How to update the latest version of Bybit Exchange? Will there be any impact if it is not updated? Feb 21, 2025 pm 10:54 PM

The way to update ByBit exchanges varies by platform and device: Mobile: Check for updates and install in the app store. Desktop Client: Check for updates in the Help menu and install automatically. Web page: You need to manually access the official website for updates. Failure to update the exchange can lead to security vulnerabilities, functional limitations, compatibility issues and reduced transaction execution efficiency.

deepseek web version entrance deepseek official website entrance deepseek web version entrance deepseek official website entrance Feb 19, 2025 pm 04:54 PM

DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Mar 05, 2025 pm 05:57 PM

Detailed explanation and installation guide for PiNetwork nodes This article will introduce the PiNetwork ecosystem in detail - Pi nodes, a key role in the PiNetwork ecosystem, and provide complete steps for installation and configuration. After the launch of the PiNetwork blockchain test network, Pi nodes have become an important part of many pioneers actively participating in the testing, preparing for the upcoming main network release. If you don’t know PiNetwork yet, please refer to what is Picoin? What is the price for listing? Pi usage, mining and security analysis. What is PiNetwork? The PiNetwork project started in 2019 and owns its exclusive cryptocurrency Pi Coin. The project aims to create a one that everyone can participate

How to install deepseek How to install deepseek Feb 19, 2025 pm 05:48 PM

There are many ways to install DeepSeek, including: compile from source (for experienced developers) using precompiled packages (for Windows users) using Docker containers (for most convenient, no need to worry about compatibility) No matter which method you choose, Please read the official documents carefully and prepare them fully to avoid unnecessary trouble.

Microsoft introduces gaming handheld-friendly Compact Mode for Xbox Game Bar Microsoft introduces gaming handheld-friendly Compact Mode for Xbox Game Bar Aug 15, 2024 am 06:32 AM

Microsoft has just announced a new Compact Mode for Xbox Game Bar, with a focus on making the overlay more usable on Windows gaming handhelds. These devices usually come with screens that are smaller than 9 inches, and things that are designed for re

Coinsuper exchange software channel official website entrance Coinsuper exchange software channel official website entrance Feb 21, 2025 pm 10:39 PM

The official website entrance of the Coinsuper Exchange: https://www.coinsuper.com. The client download channels are: Windows client, macOS client, and mobile (iOS/Android). Registration requires an email, mobile phone number and password, and you need to complete real-name authentication before you can trade. The platform provides a variety of digital asset transactions, including Bitcoin, Ethereum, etc., with the transaction fee rate of 0.1% for both orders and acceptors. Security safeguards include cold wallet storage, dual-factor verification, anti-money laundering and anti-terrorism financing measures, and with security public

See all articles