![]() ![]() For example, the following part of the script will setup Apache. I later came back and augmented it to check if something was already available (you can run vagrant up -provision to re-provision an existing machine). My first pass at this was a bit naive, though it worked. When you start your box for the first time with vagrant up, the provisioner will take care of installing additional components and configuring them. config.vm.provision "shell", path: "provision/setup.sh" Setting Up Additional Components As I mentioned earlier, I’m using a simple shell script for this machine specified with the config.vm.provision setting. ![]() This is done with a provisioner, and there are many to choose from. For example, to map the web directory to /var/"web", "/var/www/drupal8"įinally, we have to tell vagrant what do once the machine is booted up in order to configure it. If you need to map more directories, see the comments in the default Vagrantfile. So, for example, you change sites/default/ in PHPStorm in your home OS, and Drupal in the VM will process the changes. ![]() In effect, this lets you work and edit files in your favorite IDE on your machine while the guest OS sees and uses the same files. If you haven’t used Vagrant before, shared folders map one or more directories from your host machine to paths on the virtual machine. This maps your project directory to /vagrant/ on the guest OS. config.vm.network "private_network", ip: "192.168.33.10"įor this config, I’m just using the default shared folders setting. If you need your virtual machine to be accessible from other devices on your local network, look into using a public_network. Here, I’m using the private_network option, so the box and specifying an internal IP address. Next, we configure networking so that our box is accessible from the host OS. The line below tells vagrant to use a Debian 7.4 box that has chef installed (even though we won’t be using chef). There are boxes for CentOS, Redhat, and more. These are box images, many provided by the community, that have the base OS and some tools. First, we have to specify the box to build on. Let’s take a look at some key configuration settings. It controls things like how to setup networking, map files between the host and guest OS, and run the provisioner we chose. The Vagrantfile describes the machine for a project and how to configure and provision it. At the end, we’ll just have to walk through the installation steps in a browser. In this post, I’ll walk through setting up a Vagrantfile and shell script to install Apache, MySQL, PHP on a basic Debian machine automatically download and extract Drupal 8, and create a database for the site. How will your codebase run in PHP 5.6? Fire up a new machine and test it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |