In this article, we will show how to install qemu and install an ubuntu system on it.
you can directly install with brew or directly compile to code. The code is well written and I haven’t encounter some weird problems.
Though you can install the system just the same as installing an ordinary, here, we strongly suggest you directly use the precompiled official image which saves a lot of time. Just download them at https://cloud-images.ubuntu.com/ .
make a user image
Since the downloaded image has a random password for the root user “ubuntu”, we should add our user name and set access to the image. Here, we use “cloud-localds” command to achieve this. Firstly, we write our login information into a user-data file as:
Afterward, we make a user-data image with the command:
cloud-localds user-data.img user-data
Then we start the qemu simulator with the downloaded image and our user image mounted together.
Run the following code: