User Tools

Site Tools


informatica:linux:vagrant

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
informatica:linux:vagrant [2020/03/23 17:04] – created javiinformatica:linux:vagrant [2020/03/23 17:14] – [Instalación] javi
Line 95: Line 95:
   vagrant-libvirt (0.0.45, global)   vagrant-libvirt (0.0.45, global)
  
-4. Pasos adicionales+4. Pasos adicionales antes de levantar máquinas virtuales
  
-**TODO**+4.1. Añadir el usuario (en este ejemplo 'usuario') al grupo libvirt
  
 +  sudo usermod -a -G libvirt usuario
 +
 +4.2. Instalar paquetes NFS
 +
 +  sudo apt-get install nfs-common nfs-kernel-server
 +
 +===== Crear máquina virtual =====
 +
 +1. Crear vagrant file
 +
 +En este caso lo haremos manualmente, pero se podría crear con:
 +
 +  vagrant init debian/testing64
 +
 +Crear el archivo:
 +
 +  vim Vagrantfile
 +
 +Con el siguiente contenido:
 +
 +<code>
 +Vagrant.configure("2") do |config|
 +  config.vm.define :test_vm do |test_vm|
 +    test_vm.vm.box = "debian/testing64"
 +  end
 +end
 +</code>
 +
 +2. Crear la máquina virtual
 +
 +  vagrant up --provider=libvirt
 +
 +3. Comprobar
 +
 +3.1. Buscar la máquina virtual con virsh
 +
 +  sudo virsh list
 +
 +Salida esperada similar a:
 +
 +<code>
 + Id   Name                   State
 +--------------------------------------
 +    jenkins-node_test_vm   running
 +</code>
 +
 +3.2. Conectarse
 +
 +  vagrant ssh
 +  
 +Debemos estar dentro de la máquina
 +
 +4. Limpieza
 +
 +4.1. Salir de la máquina virtual
 +
 +  exit
 +  
 +4.2. Eliminar la máquina virtual
 +
 +  vagrant destroy
 +  
 +Pulsar 'y' y tecla 'enter'
 +  
 ===== Errores ===== ===== Errores =====
  
Line 165: Line 229:
   sudo apt-get install libvirt-dev   sudo apt-get install libvirt-dev
  
 +==== Error while connecting to libvirt: Error making a connection to libvirt URI qemu:///system?no_verify=1&keyfile=/home/usuario/.ssh/id_rsa: ====
 +
 +Error completo:
 +
 +<code>
 +Error while connecting to libvirt: Error making a connection to libvirt URI qemu:///system?no_verify=1&keyfile=/home/usuario/.ssh/id_rsa:
 +Call to virConnectOpen failed: authentication unavailable: no polkit agent available to authenticate action 'org.libvirt.unix.manage'
 +</code>
 +
 +Solución:
 +
 +Añadir el usuario al grupo 'libvirt'. En este ejemplo:
 +
 +  sudo usermod -a -G libvirt usuario
 +
 +==== It appears your machine doesn't support NFS, or there is not an ====
 +
 +Error completo:
 +
 +<code>
 +It appears your machine doesn't support NFS, or there is not an
 +adapter to enable NFS on this machine for Vagrant. Please verify
 +that `nfsd` is installed on your machine, and try again. If you're
 +on Windows, NFS isn't supported. If the problem persists, please
 +contact Vagrant support.
 +</code>
 +
 +Solución:
 +
 +  sudo apt-get install nfs-common nfs-kernel-server
  
informatica/linux/vagrant.txt · Last modified: 2020/05/22 10:20 by javi