Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tutoriel:virtualbox_en_environnement_serveur [Le 11/12/2010, 04:08] – Explication plus concrête lmrv | tutoriel:virtualbox_en_environnement_serveur [Le 31/01/2014, 16:07] (Version actuelle) – effacée FelixP | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | {{tag> | ||
| - | ---- | ||
| - | |||
| - | ====== VirtualBox en environnement serveur ====== | ||
| - | VirtualBox fourni VBoxManage, qui permet la création, suppression ou modification de machines virtuelles en lignes de commandes. | ||
| - | |||
| - | Avec VBoxManage, il est possible, via ssh, de contrôler à distance son parc de machines virtuelles. | ||
| - | |||
| - | Ce tutoriel reprend, étape par étape, les commandes permettant de créer et configurer une machine virtuelle. | ||
| - | |||
| - | ===== Pré-requis ===== | ||
| - | |||
| - | * Disposer des [[: | ||
| - | * VirtualBox est installé sur une installation d' | ||
| - | |||
| - | ===== Création ===== | ||
| - | Nous allons créer une machine virtuelle, que nous nommerons SRV1, destinée à accueillir un OS Ubuntu. | ||
| - | < | ||
| - | $ VBoxManage createvm --name SRV1 --ostype Ubuntu --register | ||
| - | Oracle VM VirtualBox Command Line Management Interface Version 3.2.4 | ||
| - | (C) 2005-2010 Oracle Corporation | ||
| - | All rights reserved. | ||
| - | |||
| - | Virtual machine ' | ||
| - | UUID: d1ff6a5d-9859-4df7-ab72-ad1766525ba6 | ||
| - | Settings file: '/ | ||
| - | </ | ||
| - | VBoxManage nous renvoi des informations : Notre machine SRV1 a effectivement été créée et enregistrée auprès de VirtualBox. Elle sera donc accessible depuis le GUI si nécessaire. | ||
| - | |||
| - | On pourra ainsi appeler la machine via son nom, mais également par son UUID, que l'on voit ici apparaître. | ||
| - | |||
| - | Le fichier SRV1.xml contient la configuration de notre machine virtuelle. | ||
| - | |||
| - | ===== Modification ===== | ||
| - | Nous disposons dorénavant d'une machine virtuelle SRV1. Celle-ci pour l' | ||
| - | |||
| - | Nous pouvons maintenant la modifier. Pour cela, nous utilisons l' | ||
| - | |||
| - | Etape par étape, nous allons configurer notre SRV1, en lui attribuant 256 Mo de RAM, en paramétrant sa carte réseau en mode pont. Nous voulons également en prendre le contrôle depuis un poste distant, en utilisant le client Terminal Serveur. Pour cela nous lui attribuons un port d' | ||
| - | |||
| - | Il faudra ensuite créer un nouveau disque dur pour cette machine virtuelle, lui ajouter un contrôleur SATA, et lui attribuer le nouveau disque dur. Nous ajouterons également un contrôleur IDE, pour ajouter un lecteur DVD Rom et y monter notre image ISO de Ubuntu Serveur. | ||
| - | <note important> | ||
| - | Ces étapes ne sont évidemment que des exemples de ce qu'il est possible de faire avec VBoxManage.</ | ||
| - | Pour modifier la mémoire vive de cette machine virtuelle et lui attribuer 256 Mo: | ||
| - | < | ||
| - | $ VBoxManage modifyvm SRV1 --memory 256 | ||
| - | </ | ||
| - | |||
| - | Pour modifier l' | ||
| - | |||
| - | Attention --nic1 correspond à la première carte, --nic2 à la seconde, etc. | ||
| - | < | ||
| - | $ VBoxManage modifyvm SRV1 --nic1 bridged | ||
| - | |||
| - | $ VBoxManage modifyvm SRV1 --bridgeadapter1 eth0 | ||
| - | </ | ||
| - | |||
| - | Permettre un contrôle à distance via VRDP (attention, dans ce cas, VirtualBox devient payant) | ||
| - | < | ||
| - | $ VBoxManage modifyvm SRV1 --vrdp on --vrdpport 3395 | ||
| - | </ | ||
| - | |||
| - | Désactiver certaines options si elles sont inutiles : | ||
| - | < | ||
| - | $ VBoxManage modifyvm SRV1 --usb off --audio none | ||
| - | </ | ||
| - | |||
| - | |||
| - | Créer un disque dur : | ||
| - | < | ||
| - | $ VBoxManage createhd --filename SRV1 --size 15000 | ||
| - | Oracle VM VirtualBox Command Line Management Interface Version 3.2.4 | ||
| - | (C) 2005-2010 Oracle Corporation | ||
| - | All rights reserved. | ||
| - | |||
| - | 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% | ||
| - | Disk image created. UUID: 4a5a8819-35f0-40de-a8e3-6dd3113d1746 | ||
| - | </ | ||
| - | |||
| - | Créer le controleur : | ||
| - | < | ||
| - | $ VBoxManage storagectl SRV1 --name SATA1 --add sata | ||
| - | </ | ||
| - | |||
| - | Attacher le disque au controleur : | ||
| - | < | ||
| - | $ VBoxManage storageattach SRV1 --storagectl SATA1 --port 0 --device 0 --type hdd --medium SRV1.vdi | ||
| - | </ | ||
| - | |||
| - | Créer un controleur IDE et son lecteur de dvd-rom associé : | ||
| - | |||
| - | < | ||
| - | $ VBoxManage storagectl SRV1 --name IDE1 --add ide | ||
| - | |||
| - | $ VBoxManage storageattach SRV1 --storagectl IDE1 --port 0 --device 0 --type dvddrive --medium emptydrive | ||
| - | </ | ||
| - | |||
| - | On peut aussi attacher une image iso d' | ||
| - | < | ||
| - | $ VBoxManage storageattach SRV1 --storagectl IDE1 --port 0 --device 0 --type dvddrive --medium / | ||
| - | </ | ||
| - | |||
| - | Il est à tout moment possible d' | ||
| - | < | ||
| - | $ VBoxManage showvminfo SRV1 | ||
| - | </ | ||
| - | |||
| - | ===== Lancement de la machine ===== | ||
| - | |||
| - | On peut lancer la machine avec la commande suivante : | ||
| - | < | ||
| - | $ VBoxManage startvm SRV1 --type vrdp | ||
| - | Oracle VM VirtualBox Command Line Management Interface Version 3.2.4 | ||
| - | (C) 2005-2010 Oracle Corporation | ||
| - | All rights reserved. | ||
| - | |||
| - | Waiting for the VM to power on... | ||
| - | VM has been successfully started. | ||
| - | </ | ||
| - | |||
| - | et prendre le contrôle de la machine via le Terminal Server Client. | ||
| - | |||
| - | ===== Aller plus loin... ===== | ||
| - | |||
| - | La commande VBoxManage renvoi les options possibles à utiliser avec la commande. | ||
| - | < | ||
| - | $ VBoxManage | ||
| - | Oracle VM VirtualBox Command Line Management Interface Version 3.2.4 | ||
| - | (C) 2005-2010 Oracle Corporation | ||
| - | All rights reserved. | ||
| - | |||
| - | Usage: | ||
| - | |||
| - | VBoxManage [-v|--version] | ||
| - | VBoxManage [-q|--nologo] ... suppress the logo | ||
| - | |||
| - | VBoxManage list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies| | ||
| - | bridgedifs|hostonlyifs|dhcpservers|hostinfo| | ||
| - | hostcpuids|hddbackends|hdds|dvds|floppies| | ||
| - | usbhost|usbfilters|systemproperties | ||
| - | |||
| - | VBoxManage showvminfo | ||
| - | [--machinereadable] | ||
| - | VBoxManage showvminfo | ||
| - | |||
| - | VBoxManage registervm | ||
| - | |||
| - | VBoxManage unregistervm | ||
| - | |||
| - | VBoxManage createvm | ||
| - | [--ostype < | ||
| - | [--register] | ||
| - | [--basefolder < | ||
| - | [--uuid < | ||
| - | |||
| - | VBoxManage modifyvm | ||
| - | [--name < | ||
| - | [--ostype < | ||
| - | [--memory < | ||
| - | [--pagefusion on|off] | ||
| - | [--vram < | ||
| - | [--acpi on|off] | ||
| - | [--ioapic on|off] | ||
| - | [--pae on|off] | ||
| - | [--hpet on|off] | ||
| - | [--hwvirtex on|off] | ||
| - | [--nestedpaging on|off] | ||
| - | [--largepages on|off] | ||
| - | [--vtxvpid on|off] | ||
| - | [--synthcpu on|off] | ||
| - | [--cpuidset < | ||
| - | [--cpuidremove < | ||
| - | [--cpuidremoveall] | ||
| - | [--hardwareuuid < | ||
| - | [--cpus < | ||
| - | [--cpuhotplug on|off] | ||
| - | [--plugcpu <id>] | ||
| - | [--unplugcpu <id>] | ||
| - | [--rtcuseutc on|off] | ||
| - | [--monitorcount < | ||
| - | [--accelerate3d on|off] | ||
| - | [--accelerate2dvideo on|off] | ||
| - | [--firmware bios|efi|efi32|efi64] | ||
| - | [--bioslogofadein on|off] | ||
| - | [--bioslogofadeout on|off] | ||
| - | [--bioslogodisplaytime < | ||
| - | [--bioslogoimagepath < | ||
| - | [--biosbootmenu disabled|menuonly|messageandmenu] | ||
| - | [--biossystemtimeoffset < | ||
| - | [--biospxedebug on|off] | ||
| - | [--boot< | ||
| - | [--nic< | ||
| - | vde] | ||
| - | [--nictype< | ||
| - | 82540EM|82543GC|82545EM| | ||
| - | virtio] | ||
| - | [--cableconnected< | ||
| - | [--nictrace< | ||
| - | [--nictracefile< | ||
| - | [--nicspeed< | ||
| - | [--nicbootprio< | ||
| - | [--bridgeadapter< | ||
| - | [--hostonlyadapter< | ||
| - | [--intnet< | ||
| - | [--natnet< | ||
| - | [--vdenet< | ||
| - | [--natsettings< | ||
| - | [< | ||
| - | [< | ||
| - | [--natpf< | ||
| - | < | ||
| - | [--natpf< | ||
| - | [--nattftpprefix< | ||
| - | [--nattftpfile< | ||
| - | [--nattftpserver< | ||
| - | [--natdnspassdomain< | ||
| - | [--natdnsproxy< | ||
| - | [--natdnshostresolver< | ||
| - | [--nataliasmode< | ||
| - | | ||
| - | [--macaddress< | ||
| - | [--mouse ps2|usb|usbtablet | ||
| - | [--keyboard ps2|usb | ||
| - | [--uart< | ||
| - | [--uartmode< | ||
| - | | ||
| - | | ||
| - | file < | ||
| - | < | ||
| - | [--guestmemoryballoon < | ||
| - | [--gueststatisticsinterval < | ||
| - | [--audio none|null|oss|alsa|pulse] | ||
| - | [--audiocontroller ac97|sb16] | ||
| - | [--clipboard disabled|hosttoguest|guesttohost| | ||
| - | | ||
| - | [--vrdp on|off] | ||
| - | [--vrdpport default|< | ||
| - | [--vrdpaddress < | ||
| - | [--vrdpauthtype null|external|guest] | ||
| - | [--vrdpmulticon on|off] | ||
| - | [--vrdpreusecon on|off] | ||
| - | [--vrdpvideochannel on|off] | ||
| - | [--vrdpvideochannelquality < | ||
| - | [--usb on|off] | ||
| - | [--usbehci on|off] | ||
| - | [--snapshotfolder default|< | ||
| - | [--teleporter on|off] | ||
| - | [--teleporterport < | ||
| - | [--teleporteraddress < | ||
| - | [--teleporterpassword < | ||
| - | |||
| - | VBoxManage import | ||
| - | (run with -n to have options displayed | ||
| - | for a particular OVF) | ||
| - | |||
| - | VBoxManage export | ||
| - | [--legacy09] | ||
| - | [--vsys <number of virtual system>] | ||
| - | [--product <product name>] | ||
| - | [--producturl <product url>] | ||
| - | [--vendor <vendor name>] | ||
| - | [--vendorurl <vendor url>] | ||
| - | [--version <version info>] | ||
| - | [--eula <license text>] | ||
| - | [--eulafile < | ||
| - | |||
| - | VBoxManage startvm | ||
| - | [--type gui|sdl|vrdp|headless] | ||
| - | |||
| - | VBoxManage controlvm | ||
| - | pause|resume|reset|poweroff|savestate| | ||
| - | acpipowerbutton|acpisleepbutton| | ||
| - | keyboardputscancode <hex> [< | ||
| - | injectnmi| | ||
| - | setlinkstate< | ||
| - | nic< | ||
| - | | ||
| - | nictrace< | ||
| - | nictracefile< | ||
| - | guestmemoryballoon < | ||
| - | gueststatisticsinterval < | ||
| - | usbattach < | ||
| - | usbdetach < | ||
| - | vrdp on|off | | ||
| - | vrdpport default|< | ||
| - | vrdpvideochannelquality < | ||
| - | setvideomodehint < | ||
| - | setcredentials < | ||
| - | | ||
| - | teleport --host < | ||
| - | | ||
| - | plugcpu <id> | ||
| - | unplugcpu <id> | ||
| - | |||
| - | VBoxManage discardstate | ||
| - | |||
| - | VBoxManage adoptstate | ||
| - | |||
| - | VBoxManage snapshot | ||
| - | take < | ||
| - | delete < | ||
| - | restore < | ||
| - | restorecurrent | | ||
| - | edit < | ||
| - | | ||
| - | | ||
| - | showvminfo < | ||
| - | |||
| - | VBoxManage openmedium | ||
| - | [--type normal|immutable|writethrough] (disk only) | ||
| - | [--uuid < | ||
| - | [--parentuuid < | ||
| - | |||
| - | VBoxManage closemedium | ||
| - | [--delete] | ||
| - | |||
| - | VBoxManage storageattach | ||
| - | --storagectl < | ||
| - | --port < | ||
| - | --device < | ||
| - | [--type dvddrive|hdd|fdd] | ||
| - | [--medium none|emptydrive| | ||
| - | < | ||
| - | [--passthrough on|off] | ||
| - | [--forceunmount] | ||
| - | |||
| - | VBoxManage storagectl | ||
| - | --name < | ||
| - | [--add ide|sata|scsi|floppy|sas] | ||
| - | [--controller LSILogic|LSILogicSAS|BusLogic| | ||
| - | IntelAHCI|PIIX3|PIIX4|ICH6|I82078] | ||
| - | [--sataideemulation< | ||
| - | [--sataportcount < | ||
| - | [--hostiocache on|off] | ||
| - | [--remove] | ||
| - | |||
| - | VBoxManage showhdinfo | ||
| - | |||
| - | VBoxManage createhd | ||
| - | --size < | ||
| - | [--format VDI|VMDK|VHD] (default: VDI) | ||
| - | [--variant Standard, | ||
| - | [--type normal|writethrough] (default: normal) | ||
| - | [--comment < | ||
| - | [--remember] | ||
| - | |||
| - | VBoxManage modifyhd | ||
| - | [--type normal|writethrough|immutable] | ||
| - | [--autoreset on|off] | ||
| - | [--compact] | ||
| - | |||
| - | VBoxManage clonehd | ||
| - | [--format VDI|VMDK|VHD|RAW|< | ||
| - | [--variant Standard, | ||
| - | [--type normal|writethrough|immutable] | ||
| - | [--remember] [--existing] | ||
| - | |||
| - | VBoxManage convertfromraw | ||
| - | [--format VDI|VMDK|VHD] | ||
| - | [--variant Standard, | ||
| - | VBoxManage convertfromraw | ||
| - | [--format VDI|VMDK|VHD] | ||
| - | [--variant Standard, | ||
| - | |||
| - | VBoxManage addiscsidisk | ||
| - | --target < | ||
| - | [--port < | ||
| - | [--lun < | ||
| - | [--encodedlun < | ||
| - | [--username < | ||
| - | [--password < | ||
| - | [--type normal|writethrough|immutable] | ||
| - | [--intnet] | ||
| - | |||
| - | VBoxManage getextradata | ||
| - | < | ||
| - | |||
| - | VBoxManage setextradata | ||
| - | <key> | ||
| - | [< | ||
| - | |||
| - | VBoxManage setproperty | ||
| - | machinefolder default|< | ||
| - | vrdpauthlibrary default|< | ||
| - | websrvauthlibrary default|null|< | ||
| - | loghistorycount < | ||
| - | |||
| - | VBoxManage usbfilter | ||
| - | --target < | ||
| - | --name < | ||
| - | --action ignore|hold (global filters only) | ||
| - | [--active yes|no] (yes) | ||
| - | [--vendorid < | ||
| - | [--productid < | ||
| - | [--revision < | ||
| - | [--manufacturer < | ||
| - | [--product < | ||
| - | [--remote yes|no] (null, VM filters only) | ||
| - | [--serialnumber < | ||
| - | [--maskedinterfaces < | ||
| - | |||
| - | VBoxManage usbfilter | ||
| - | --target < | ||
| - | [--name < | ||
| - | [--action ignore|hold] (global filters only) | ||
| - | [--active yes|no] | ||
| - | [--vendorid < | ||
| - | [--productid < | ||
| - | [--revision < | ||
| - | [--manufacturer < | ||
| - | [--product < | ||
| - | [--remote yes|no] (null, VM filters only) | ||
| - | [--serialnumber < | ||
| - | [--maskedinterfaces < | ||
| - | |||
| - | VBoxManage usbfilter | ||
| - | --target < | ||
| - | |||
| - | VBoxManage sharedfolder | ||
| - | --name < | ||
| - | [--transient] [--readonly] | ||
| - | |||
| - | VBoxManage sharedfolder | ||
| - | --name < | ||
| - | |||
| - | VBoxManage vmstatistics | ||
| - | [--pattern < | ||
| - | |||
| - | VBoxManage guestproperty | ||
| - | < | ||
| - | |||
| - | VBoxManage guestproperty | ||
| - | < | ||
| - | |||
| - | VBoxManage guestproperty | ||
| - | [--patterns < | ||
| - | |||
| - | VBoxManage guestproperty | ||
| - | [--timeout < | ||
| - | |||
| - | VBoxManage guestcontrol | ||
| - | <path to program> | ||
| - | --username < | ||
| - | [--arguments "< | ||
| - | [--environment "< | ||
| - | [--flags < | ||
| - | [--verbose] [--wait-for exit, | ||
| - | |||
| - | VBoxManage metrics | ||
| - | | ||
| - | |||
| - | VBoxManage metrics | ||
| - | [--period < | ||
| - | [--samples < | ||
| - | [--list] | ||
| - | [*|host|< | ||
| - | |||
| - | VBoxManage metrics | ||
| - | |||
| - | VBoxManage metrics | ||
| - | [--list] | ||
| - | [*|host|< | ||
| - | |||
| - | VBoxManage metrics | ||
| - | [--list] | ||
| - | [*|host|< | ||
| - | |||
| - | VBoxManage metrics | ||
| - | [--period < | ||
| - | [--samples < | ||
| - | [--list] | ||
| - | [--detach] | ||
| - | [*|host|< | ||
| - | |||
| - | VBoxManage hostonlyif | ||
| - | [--dhcp | | ||
| - | --ip< | ||
| - | --ipv6< | ||
| - | |||
| - | VBoxManage dhcpserver | ||
| - | | ||
| - | [--ip < | ||
| - | | ||
| - | | ||
| - | | ||
| - | [--enable | --disable] | ||
| - | |||
| - | VBoxManage dhcpserver | ||
| - | | ||
| - | </ | ||
| - | |||
| - | |||
| - | ===== Conclusion ===== | ||
| - | |||
| - | |||
| - | Des fonctionnalités de plus en plus nombreuses viennent enrichir VirtualBox au fur et à mesure des versions, comme l' | ||
| - | |||
| - | |||
| - | ===== Problèmes connus===== | ||
| - | |||
| - | |||
| - | |||
| - | ===== Voir aussi ===== | ||
| - | |||
| - | * **(fr)** [[: | ||
| - | |||
| - | ---- | ||
| - | // | ||
