« Modèle:NewVM » : différence entre les versions

De wiki.infini
import>Fleon
(Page créée avec « <includeonly> La machine physique '''{{{machine_phys}}}''' héberge la VM, création du fichier de config : <pre> {{{machine_phys}}} machines_virtuelles # cp template.xml... »)
 
m (33 révisions importées)
 
(32 versions intermédiaires par un autre utilisateur non affichées)
Ligne 1 : Ligne 1 :
<includeonly>
<includeonly>
{{InfoBox stack
|{{InfoBox head| [http://munin.infini.fr/vm_{{{machine_phys}}}/{{{vmname}}}.infini.mdl/index.html] {{{vmname}}} @ {{{machine_phys}}} }}
|{{InfoBox line| MEMORY : {{{memory}}} }}
|{{InfoBox line| CPU : {{{cpu}}} }}
|{{InfoBox line| LVM : /dev/vg0/{{{vmname}}}_sys / {{{sys_size|}}} }}
|{{InfoBox line| LVM : /dev/vg0/{{{vmname}}}_swap / {{{swap_size|}}} }}
|{{InfoBox line| LVM : {{#if:{{{data_size|}}} | /dev/vg0/{{{vmname}}}_data / {{{data_size|}}} | nan}} }}
|{{InfoBox line| MAC : {{{mac}}} }}
|{{InfoBox line| NET : {{{iface}}} / {{{ip_vm|}}} }}
|{{InfoBox line| VNC : {{{vnc}}} }}
}}
La machine physique '''{{{machine_phys}}}''' héberge la VM, création du fichier de config :
La machine physique '''{{{machine_phys}}}''' héberge la VM, création du fichier de config :


<pre>
{{RootCmd | hostname={{{machine_phys}}}
{{{machine_phys}}} machines_virtuelles # cp template.xml mel01.xml
| cd /etc/kvm/machines_virtuelles
{{{machine_phys}}} machines_virtuelles # nano mel01.xml
| cp template.xml {{{vmname}}}.xml
</pre>
| nano {{{vmname}}}.xml
 
}}
* VMNAME = mel01
* MEM = 2097152
* CPU = 2
* LVM = /dev/vg0/mel01_sys
* LVM = /dev/vg0/mel01_swap
* MAC = 00:16:3E:85:8F:5D
* NET = br0 / br1 / br2 / br3
* VNC = 32093


Création des volumes LVM :
Création des volumes LVM :


<pre>
{{RootCmd | hostname={{{machine_phys}}}
{{{machine_phys}}} machines_virtuelles # lvcreate -L 30G -n mel01_sys vg0
| lvcreate -L {{{sys_size}}} -n {{{vmname}}}_sys vg0
{{{machine_phys}}} machines_virtuelles # lvcreate -L 512M -n mel01_swap vg0
| lvcreate -L {{{swap_size}}} -n {{{vmname}}}_swap vg0
</pre>
| {{#if:{{{data_size|}}} | lvcreate -L {{{data_size}}} -n {{{vmname}}}_data vg0 }}
}}


Démarrage de la vm :
Démarrage de la vm :


<pre>
{{RootCmd | hostname={{{machine_phys}}}
{{{machine_phys}}} machines_virtuelles # virsh create mel01.xml
| virsh create {{{vmname}}}.xml
</pre>
}}


Connexion VNC :
Connexion VNC :


<pre>
{{RootCmd | hostname=remote
remote ~ # ssh -p443 user@mx1.infini.fr -L5901:192.168.10.39:32093
| ssh -p443 user@mx1.infini.fr -L5901:{{{ip_phys}}}:{{{vnc}}}
remote ~ # vncviewer localhost:1
| vncviewer localhost:1
</pre>
}}
</includeonly>
 
{{#if:{{{data_size|}}}| |<br/><br/>}}
On termine en ajoutant la machine au fichier '''/etc/rc.local''' pour garantir qu'elle sera relancée au démarrage de {{{machine_phys}}} :
 
{{FileBox|filename={{{machine_phys}}} ~ vi /etc/rc.local | 1=
sleep 2
virsh create /etc/kvm/machines_virtuelles/{{{vmname}}}.xml
}}


<noinclude>[[Category:Template]]</noinclude>
* {{{install_summary}}}

Version actuelle datée du 12 février 2020 à 19:52