Diferencia entre revisiones de «Virtualization with libvirt»
 (Página creada con «For the realization of this practice you will need an Ubuntu Cloud image that we will download from https://cloud-images.ubuntu.com/ and we will need a host system with Ubu...»)  | 
				|||
| Línea 70: | Línea 70: | ||
| − | Translated with www.DeepL.com/Translator (free version)  | + | Translated with www.DeepL.com/Translator (free version)For the realization of this practice you will need an Ubuntu Cloud image that we will download from https://cloud-images.ubuntu.com/ and we will need a  | 
| + | host system with Ubuntu 18.04.  | ||
| + | |||
| + | In this practice we will use the image downloaded from the Ubuntu Cloud website and we will use the '''cloud-init''' tool to configure it.  | ||
| + | |||
| + | Next, we will use the Ubuntu image already configured to be imported to the virtualization software '''libvirt''''.  | ||
| + | |||
| + | = Step 1: Downloading the Ubuntu Cloud image  | ||
| + | |||
| + | We enter https://cloud-images.ubuntu.com/ and download the Ubuntu 18.04 LTS (Long Time Support) image.  | ||
| + | |||
| + | You can download it directly with the command ''wget'':  | ||
| + | |||
| + | <syntaxhighlight lang="bash">  | ||
| + | wget https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img  | ||
| + | </syntaxhighlight>  | ||
| + | |||
| + | if it started downloading you will see output similar to this:  | ||
| + | |||
| + | <syntaxhighlight lang="bash">  | ||
| + | -2019-08-06 12:26:26-- https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img  | ||
| + | Resolving cloud-images.ubuntu.com (cloud-images.ubuntu.com).... 91.189.88.89, 2001:67c:1560:8001::8001  | ||
| + | Connecting to cloud-images.ubuntu.com (cloud-images.ubuntu.com)[91.189.88.89]:443... connected.  | ||
| + | HTTP request sent, waiting for response... 200 OK  | ||
| + | Length: 343474176 (328M) [application/octet-stream] [application/octet-stream] [application/octet-stream]...  | ||
| + | Saving to: "bionic-server-cloudimg-amd64.img"  | ||
| + | |||
| + | bionic-server-cloudimg-amd64.img. 0%[ ] 2.21M 472KB/s eta 14m 6s  | ||
| + | </syntaxhighlight>  | ||
| + | |||
| + | Wait until the image is 100% downloaded.  | ||
| + | |||
| + | The Ubuntu cloud image comes with 2 GBytes of space by default, you can expand the size with the following command before using it in the virtual machine:  | ||
| + | |||
| + | <syntaxhighlight lang="bash">  | ||
| + | qemu-img resize bionic-server-cloudimg-amd64.img +8G  | ||
| + | </syntaxhighlight>  | ||
| + | |||
| + | This increases the image by 8 Gbytes, so you are left with a 10 GByte Ubuntu cloud image.  | ||
| + | |||
| + | = Step 3: Installing the libguestfs package =  | ||
| + | |||
| + | Next, you have to install the [[packages]] that provide the ''virt-customize'' tool to configure the Ubuntu image you downloaded.  | ||
| + | |||
| + | We can install these packages with the '''apt'''' tool from the shell.  | ||
| + | |||
| + | For Ubuntu 18.04:  | ||
| + | |||
| + | <syntaxhighlight lang="bash">  | ||
| + | sudo apt install libguestfs  | ||
| + | </syntaxhighlight>  | ||
| + | |||
| + | For Ubuntu 20.04:  | ||
| + | |||
| + | <syntaxhighlight lang="bash">  | ||
| + | sudo apt install libguestfs-tools  | ||
| + | </syntaxhighlight>  | ||
| + | |||
| + | ''On the practice classroom computers these packages will already be pre-installed, so you can skip this step.''  | ||
| + | |||
| + | = Step 3: Configuring the Ubuntu image with virt-customize =  | ||
| + | |||
| + | The ''virt-customize'' command allows you to set the password of the administrator user of the image we have downloaded.  | ||
| + | |||
| + | <syntaxhighlight lang="bash">  | ||
| + | virt-customize -a bionic-server-cloudimg-amd64.img --root-password password:coolpass  | ||
| + | </syntaxhighlight>  | ||
| + | |||
| + | The above example shows how to configure the downloaded image to have the user ''root'', and in this case, the password is ''coolpass''.  | ||
Revisión del 15:53 23 nov 2021
For the realization of this practice you will need an Ubuntu Cloud image that we will download from https://cloud-images.ubuntu.com/ and we will need a host system with Ubuntu 18.04.
In this practice we will use the image downloaded from the Ubuntu Cloud website and we will use the cloud-init tool to configure it.
Next, we will use the Ubuntu image already configured to be imported to the virtualization software libvirt'.
= Step 1: Downloading the Ubuntu Cloud image
We enter https://cloud-images.ubuntu.com/ and download the Ubuntu 18.04 LTS (Long Time Support) image.
You can download it directly with the command wget:
wget https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.imgif it started downloading you will see output similar to this:
-2019-08-06 12:26:26-- https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img
Resolving cloud-images.ubuntu.com (cloud-images.ubuntu.com).... 91.189.88.89, 2001:67c:1560:8001::8001
Connecting to cloud-images.ubuntu.com (cloud-images.ubuntu.com)[91.189.88.89]:443... connected.
HTTP request sent, waiting for response... 200 OK
Length: 343474176 (328M) [application/octet-stream] [application/octet-stream] [application/octet-stream]...
Saving to: "bionic-server-cloudimg-amd64.img"
bionic-server-cloudimg-amd64.img. 0%[ ] 2.21M 472KB/s eta 14m 6sWait until the image is 100% downloaded.
The Ubuntu cloud image comes with 2 GBytes of space by default, you can expand the size with the following command before using it in the virtual machine:
qemu-img resize bionic-server-cloudimg-amd64.img +8GThis increases the image by 8 Gbytes, so you are left with a 10 GByte Ubuntu cloud image.
Contenido
Step 3: Installing the libguestfs package
Next, you have to install the packages that provide the virt-customize tool to configure the Ubuntu image you downloaded.
We can install these packages with the apt' tool from the shell.
For Ubuntu 18.04:
sudo apt install libguestfsFor Ubuntu 20.04:
sudo apt install libguestfs-toolsOn the practice classroom computers these packages will already be pre-installed, so you can skip this step.
Step 3: Configuring the Ubuntu image with virt-customize
The virt-customize command allows you to set the password of the administrator user of the image we have downloaded.
virt-customize -a bionic-server-cloudimg-amd64.img --root-password password:coolpassThe above example shows how to configure the downloaded image to have the user root, and in this case, the password is coolpass.
Translated with www.DeepL.com/Translator (free version)For the realization of this practice you will need an Ubuntu Cloud image that we will download from https://cloud-images.ubuntu.com/ and we will need a
host system with Ubuntu 18.04.
In this practice we will use the image downloaded from the Ubuntu Cloud website and we will use the cloud-init tool to configure it.
Next, we will use the Ubuntu image already configured to be imported to the virtualization software libvirt'.
= Step 1: Downloading the Ubuntu Cloud image
We enter https://cloud-images.ubuntu.com/ and download the Ubuntu 18.04 LTS (Long Time Support) image.
You can download it directly with the command wget:
wget https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.imgif it started downloading you will see output similar to this:
-2019-08-06 12:26:26-- https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img
Resolving cloud-images.ubuntu.com (cloud-images.ubuntu.com).... 91.189.88.89, 2001:67c:1560:8001::8001
Connecting to cloud-images.ubuntu.com (cloud-images.ubuntu.com)[91.189.88.89]:443... connected.
HTTP request sent, waiting for response... 200 OK
Length: 343474176 (328M) [application/octet-stream] [application/octet-stream] [application/octet-stream]...
Saving to: "bionic-server-cloudimg-amd64.img"
bionic-server-cloudimg-amd64.img. 0%[ ] 2.21M 472KB/s eta 14m 6sWait until the image is 100% downloaded.
The Ubuntu cloud image comes with 2 GBytes of space by default, you can expand the size with the following command before using it in the virtual machine:
qemu-img resize bionic-server-cloudimg-amd64.img +8GThis increases the image by 8 Gbytes, so you are left with a 10 GByte Ubuntu cloud image.
Step 3: Installing the libguestfs package
Next, you have to install the packages that provide the virt-customize tool to configure the Ubuntu image you downloaded.
We can install these packages with the apt' tool from the shell.
For Ubuntu 18.04:
sudo apt install libguestfsFor Ubuntu 20.04:
sudo apt install libguestfs-toolsOn the practice classroom computers these packages will already be pre-installed, so you can skip this step.
Step 3: Configuring the Ubuntu image with virt-customize
The virt-customize command allows you to set the password of the administrator user of the image we have downloaded.
virt-customize -a bionic-server-cloudimg-amd64.img --root-password password:coolpassThe above example shows how to configure the downloaded image to have the user root, and in this case, the password is coolpass.