apply changes to provisioning guide

This commit is contained in:
Jeff Escalante 2020-05-28 12:47:24 -04:00
parent df1621f264
commit 881c3a6e78
No known key found for this signature in database
GPG Key ID: 32D23C61AB5450DB

View File

@ -23,8 +23,25 @@ so that the guest machine can be repeatably created and ready-to-use.
## Installing Apache
We will just setup [Apache](http://httpd.apache.org/) for our basic project,
and we will do so using a shell script. Create the following shell script
and save it as `bootstrap.sh` in the same directory as your Vagrantfile:
and we will do so using a shell script. First, we need to add some html content
which will be served by the Apache webserver. This will act as our DocumentRoot
folder. To do this create a subdirectory named `html` in the project root
directory. In the `html` directory create a html file named `index.html`.
For example:
```html
<!DOCTYPE html>
<html>
<body>
<h1>Getting started with Vagrant!</h1>
</body>
</html>
```
The script below will symlink our shared folder `/vagrant` so that apache serves
the `html` folder when accessing the root page locally. Now, create the
following shell script and save it as `bootstrap.sh` in the same directory as
your Vagrantfile:
```bash
#!/usr/bin/env bash
@ -52,28 +69,14 @@ The "provision" line is new, and tells Vagrant to use the `shell` provisioner
to setup the machine, with the `bootstrap.sh` file. The file path is relative
to the location of the project root (where the Vagrantfile is).
We also need to add some html content which will be served by the Apache webserver.
To do this create a subdirectory named `html` in the project root directory.
In the `html` directory create a html file named `index.html`.
For example:
```html
<!DOCTYPE html>
<html>
<body>
<h1>Getting started with Vagrant!</h1>
</body>
</html>
```
## Provision!
After everything is configured, just run `vagrant up` to create your
machine and Vagrant will automatically provision it. You should see
the output from the shell script appear in your terminal. If the guest
machine is already running from a previous step, run `vagrant reload --provision`,
which will quickly restart your virtual machine, skipping the initial
import step. The provision flag on the reload command instructs Vagrant to
which will quickly restart your virtual machine, skipping the initial import
step. The provision flag on the reload command instructs Vagrant to
run the provisioners, since usually Vagrant will only do this on the first
`vagrant up`.