Local Wordpress development with OS X and Vagrant
Vagrant together with VirtualBox allows you to create portable virtual machines development. For instance, you no longer have to fiddle around with MAMP or LAMP or whatever when you’re doing local PHP development.
Instead you install a box using Vagrant. This box can easily be shared with your coworkers and it doesn’t pollute your computer with scripts and installs everywhere.
Getting started with Vagrant
1) Install Vagrant 2) Install VirtualBox
Configuring a box for Drupal development
Configuring a box for Wordpress development with VVV
Configuring a box for Wordpress development with Vagrantpress
Next up is choosing a box to use. For this example we’re going with Vagrantpress which is a Ubuntu preconfigured for Wordpress development.
git clone https://github.com/chad-thompson/vagrantpress 4)
cd vagrantpress 5)
vagrant up (this will download 500mb the first time)
vagrant up will start the box.
You now have a brand new Wordpress install available:
You can access phpMyAdmin:
Check the Vagrantpress documentation for more.
Extending Wordpress with Timber
Timber extends Wordpress with the Twig templating engine, also used by Drupal 8 and seperates logic from presentation by giving you two files for every page. For instance: a page.php for getting data from Wordpress and a page.twig for the markup. And it doesn’t have any measurable performance hit.
To power up your vagrant box: vagrant up To access your box via ssh: vagrant ssh To suspend your vagrant box: vagrant suspend To shut down your vagrant box: vagrant halt To destroy your vagrant box (this will remove it completely): vagrant destroy
If you’re using Sublime Text, be sure to install the the PHP-TWIG package to get proper syntax highlighting.
brew update brew tap homebrew/dupes brew tap homebrew/php brew install composer
cd ~/MYSITE/wp-content/plugins git clone email@example.com:jarednova/timber.git cd timber composer install
Local Drupal development on OS X using Vagrant
Here you’ll learn how to create install Drupal in a virtual environment on your PC. This means you’ll be able to sync, backup and locally do all your development which is both faster and safer.
Once it’s running, you can learn how to install Drupal 7 or 8 here:
After they’re installed, use these two links:
Add this to your /etc/hosts file:
# Sites declared in VDD's config.json 192.168.44.44 drupal8.dev 192.168.44.44 www.drupal8.dev 192.168.44.44 drupal7.dev 192.168.44.44 www.drupal7.dev # End of sites declared with VDD
How to install Drupal 8 using VDD
First cd into the vdd folder (where the vagrantfile is). Then run these commands:
bash vagrant ssh cd ~/sites/drupal8 git clone --branch 8.0.x http://git.drupal.org/project/drupal.git . drush @drupal8 si standard -y
- Download and install VirtualBox
- Download and install Vagrant
- Install Ansible (mac/linux only)
Drush on webfaction
- SSH in
- cd bin (or mkdir bin; cd bin)
- curl -sS https://getcomposer.org/installer | php55
- php55 bin/composer.phar global require drush/drush:dev-master