Outils pour utilisateurs

Outils du site


devweb:vagrant (lu 25373 fois)

Ceci est une ancienne révision du document !


Vagrant

Apparemment c’est le truc qui va bien pour installer une VM pour faire du dev sans pourrir sa machine.

Installation

Installer virtualbox (4 car j’ai eu des problèmes avec la 5)

sudo apt-get install virtualbox virtualbox-dkms virtualbox-qt

Ne pas installer le vagrant disponible dans les paquets car la version est obsolète. Par exemple, la version 1.4 dispo ne supporte pas virtualbox 5 contrairement à la version dispo sur le site de vagrant qui est en 1.8

https://www.vagrantup.com/downloads.html

Créer sa première machine

J’ai cherché un peu sur la catalogue https://atlas.hashicorp.com et j’ai chercher une debian avec apache php mysql.

J’ai trouvé celle ci ⇒ https://atlas.hashicorp.com/tjo/boxes/debian-jessie64-lamp-stack

On crée un répertoire de travail

mkdir /home/user/dev/mon_projet
cd /home/user/dev/mon_projet

et on tape la commande fournit

$ vagrant init tjo/debian-jessie64-lamp-stack; vagrant up --provider virtualbox

Vagrant is upgrading some internal state for the latest version.
Please do not quit Vagrant at this time. While upgrading, Vagrant
will need to copy all your boxes, so it will use a considerable
amount of disk space. After it is done upgrading, the temporary disk
space will be freed.

Press ctrl-c now to exit if you want to remove some boxes or free
up some disk space.

Press the Enter or Return key to continue.
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'tjo/debian-jessie64-lamp-stack' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'tjo/debian-jessie64-lamp-stack'
    default: URL: https://atlas.hashicorp.com/tjo/debian-jessie64-lamp-stack
==> default: Adding box 'tjo/debian-jessie64-lamp-stack' (v0.0.1) for provider: virtualbox
    default: Downloading: https://atlas.hashicorp.com/tjo/boxes/debian-jessie64-lamp-stack/versions/0.0.1/providers/virtualbox.box
==> default: Successfully added box 'tjo/debian-jessie64-lamp-stack' (v0.0.1) for 'virtualbox'!
==> default: Importing base box 'tjo/debian-jessie64-lamp-stack'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'tjo/debian-jessie64-lamp-stack' is up to date...
==> default: Setting the name of the VM: mon_projet_default_1469711707174_99813
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
devweb/vagrant.1469712552.txt.gz · Dernière modification: 28-07-2016 15:29 de edmc73