Vagrant machine is running under 192.168.10.10
1 2 3 4 |
xdebug.remote_enable = on xdebug.remote_connect_back = on xdebug.remote_host="192.168.10.10" xdebug.idekey = "vagrant" |
Vagrant machine is running under 192.168.10.10
1 2 3 4 |
xdebug.remote_enable = on xdebug.remote_connect_back = on xdebug.remote_host="192.168.10.10" xdebug.idekey = "vagrant" |
Info and upload:
https://atlas.hashicorp.com/help/vagrant/boxes/create
Pack a box with virtualbox
1 |
vagrant package --base <virtual_maschine_name> --output mybox.box |
Avoid the generation of a ssh key!
Insert this into your Vagrantfile during box creation
1 |
config.ssh.insert_key=false |
Remove an existing ssh key from a box
1 2 3 4 |
wget https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -O .ssh/authorized_keys chmod 700 .ssh chmod 600 .ssh/authorized_keys chown -R vagrant:vagrant .ssh |
Update Virtualbox Guest Addition
http://kvz.io/blog/2013/01/16/vagrant-tip-keep-virtualbox-guest-additions-in-sync/
1 |
vagrant plugin install vagrant<span class="token operator">-</span>vbguest |
Use specific box version
https://www.vagrantup.com/docs/boxes/versioning.html
1 |
config.vm.box_version >= 1.0.0 |
And again. I could not start my VM’s after updating Virtualbox to 4.3.28
The issue was the same like described here.
A downgrade to 4.3.18 fixed the problem.
https://www.virtualbox.org/wiki/Download_Old_Builds_4_3_pre24
A vagrant Ubuntu Server 32bit 14.04 LTS with Apache, MySQl, PHP and several development tools installed.
The server contains the following components:
The result can be used here: https://atlas.hashicorp.com/alexwenzel/boxes/webdev
Initzialize vagrant:
1 |
vagrant init ubuntu/trusty32 |
Edit the initial vagrant file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# -*- mode: ruby -*- # vi: set ft=ruby : # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "ubuntu/trusty32" config.vm.network "private_network", ip: "192.168.10.10" config.vm.synced_folder "./www", "/var/www" config.vm.provider "virtualbox" do |vb| vb.memory = 2048 end end |
Then create the “www” folder and start vagrant:
1 |
vagrant up |
SSH into the new vagrant box:
1 2 |
login as: vagrant vagrant@127.0.0.1's password: vagrant |
A quick ubuntu update:
1 2 3 |
sudo su apt-get update apt-get upgrade -y |
Apache Webserver:
1 |
apt-get install apache2 -y |
1 2 3 4 5 6 7 8 9 |
# add a server name ServerName webdev # modify directory configuration <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> |
http://httpd.apache.org/docs/2.4/sections.html
PHP, MySQL, SQLite, PHP cUrl, Git:
1 |
apt-get install php5 libapache2-mod-php5 mysql-server php5-mysql php5-sqlite php5-curl git -y |
NodeJs, npm:
1 2 |
curl -sL https://deb.nodesource.com/setup | sudo bash - apt-get install nodejs -y |
Composer:
1 2 |
curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer |
1 |
apt-get install php5-xdebug |
1 2 3 4 5 |
zend_extension=xdebug.so xdebug.profiler_enable_trigger = 1 xdebug.profiler_enable = 0 xdebug.profiler_output_dir = /var/www/xdebug/ |
http://alexwenzel.de/2014/191/php-profiling-xdebug
1 |
vagrant package --base <virtual_maschine_name> --output mybox.box |
Test the box:
1 2 3 4 5 6 |
$ vagrant box add my-box /path/to/the/new.box ... $ vagrant init my-box ... $ vagrant up ... |
My virtualbox made me crazy with this problem. I couldn’t start my boxes. Vagrant hung up everytime at
1 |
==> default: Booting VM... |
The Problem and solution is described here:
https://forums.virtualbox.org/viewtopic.php?f=6&t=63556&start=30
Additionally to my fully functional development environment described here, I want to have some more programs.
I liked WAMP very much, but after discovering Vagrant I never will go back to WAMP.
What is Vagrant used for?
Create and configure lightweight, reproducible, and portable development environments.
In my words: Vagrant is used to simulate a real server environment to interact with.
In this article I want to share my basic setup.