VirtualBox por linha de comando: instalando Guest Additions

No Host, primeiro listo as VMs:

[ricardo@Oracle ~]$ VBoxManage list vms
"eva00" {440cf69e-18c5-4279-99fd-82343a9e30ae}
"Teste01" {8cf64608-6eae-44c0-9647-ffeaf14589dd}
"Teste02" {8fda6700-a9a1-4bd6-acbc-f88b8a2905c3}
"Teste03" {72d33bb4-f914-4308-b016-aafec747f7b9}
"Teste04" {65764537-6a97-47d0-b4d6-7dbc29acf5d6}
"Teste05" {057572ff-deaa-4792-8567-ceaa4577dd4e}
"Teste06" {a283d3d2-3315-42ef-89af-e908abe35a98}
"Teste07" {325d1d79-a5d4-4e29-acea-3b019a147b0c}
"Percona XtraDB Cluster" {bcec78f6-cf64-4ac0-8162-90d3546657a4}
"Percona XtraDB Cluster 01" {28501ec7-a04d-43f7-a634-59fe315e60a0}
"Percona XtraDB Cluster 02" {008c3ecc-34b8-4bde-86bc-f473c556167b}
"Percona XtraDB Cluster 03" {2981e89f-8539-4687-87e8-f429f1f6bedf}
"Percona XtraDB Cluster 04" {2408740c-fd75-41a5-8bc8-b1ed435c1c65}
"Percona XtraDB Cluster 05" {fefce3d6-d8a3-4768-9a33-1bf40063f642}
"Percona XtraDB Cluster 06" {f57dccbe-ac1d-4648-a6c7-2836a4837924}
[ricardo@Oracle ~]$

Ainda no Host, agora verifico qual controladora de discos uma das VMs tem:

[ricardo@Oracle ~]$ VBoxManage showvminfo "Percona XtraDB Cluster 01" | grep "Storage Controller Name"
Storage Controller Name (0):            IDE
Storage Controller Name (1):            SATA
[ricardo@Oracle ~]$

Ainda no Host, com o comando abaixo o CD do Guest Additions é “colocado” nas VMs:

[ricardo@Oracle ~]$ VBoxManage storageattach "Percona XtraDB Cluster 01" --storagectl "IDE" --port 1 --device 0 --type dvddrive --medium /usr/share/virtualbox/VBoxGuestAdditions.iso
[ricardo@Oracle ~]$ VBoxManage storageattach "Percona XtraDB Cluster 02" --storagectl "IDE" --port 1 --device 0 --type dvddrive --medium /usr/share/virtualbox/VBoxGuestAdditions.iso
[ricardo@Oracle ~]$ VBoxManage storageattach "Percona XtraDB Cluster 03" --storagectl "IDE" --port 1 --device 0 --type dvddrive --medium /usr/share/virtualbox/VBoxGuestAdditions.iso
[ricardo@Oracle ~]$ VBoxManage storageattach "Percona XtraDB Cluster 04" --storagectl "IDE" --port 1 --device 0 --type dvddrive --medium /usr/share/virtualbox/VBoxGuestAdditions.iso
[ricardo@Oracle ~]$ VBoxManage storageattach "Percona XtraDB Cluster 05" --storagectl "IDE" --port 1 --device 0 --type dvddrive --medium /usr/share/virtualbox/VBoxGuestAdditions.iso
[ricardo@Oracle ~]$ VBoxManage storageattach "Percona XtraDB Cluster 06" --storagectl "IDE" --port 1 --device 0 --type dvddrive --medium /usr/share/virtualbox/VBoxGuestAdditions.iso
[ricardo@Oracle ~]$

Na VM, instalo os pré-requisitos:

ricardo@Percona02:~$ sudo apt-get -y install linux-headers-$(uname -r) gcc make perl
...
ricardo@Percona02:~$

Na VM, monto o CD:

ricardo@Percona02:~$ sudo mkdir /mnt/dvd
ricardo@Percona02:~$ sudo mount /dev/cdrom /mnt/dvd/
mount: /dev/sr0 é protegido contra gravação; montando como somente-leitura
ricardo@Percona02:~$

E finalmente, instalo o GuestAdditions na VM:

ricardo@Percona02:~$ /mnt/dvd/VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 6.0.10 Guest Additions for Linux........
This program must be run with administrator privileges.  Aborting
ricardo@Percona02:~$ sudo /mnt/dvd/VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 6.0.10 Guest Additions for Linux........
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup 
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel 4.9.0-9-amd64.
update-initramfs: Generating /boot/initrd.img-4.9.0-9-amd64
ricardo@Percona02:~$

Leave a Reply

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

Esse site utiliza o Akismet para reduzir spam. Aprenda como seus dados de comentários são processados.