--- layout: "intro" page_title: "Provisioning - Getting Started" sidebar_current: "gettingstarted-provisioning" description: |- We have a virtual machine running a basic copy of Ubuntu and we can edit files from our machine and have them synced into the virtual machine. Let us now serve those files using a webserver. --- # Provisioning Alright, so we have a virtual machine running a basic copy of Ubuntu and we can edit files from our machine and have them synced into the virtual machine. Let us now serve those files using a webserver. We could just SSH in and install a webserver and be on our way, but then every person who used Vagrant would have to do the same thing. Instead, Vagrant has built-in support for _automated provisioning_. Using this feature, Vagrant will automatically install software when you `vagrant up` 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: ```bash #!/usr/bin/env bash apt-get update apt-get install -y apache2 if ! [ -L /var/www ]; then rm -rf /var/www ln -fs /vagrant /var/www fi ``` Next, we configure Vagrant to run this shell script when setting up our machine. We do this by editing the Vagrantfile, which should now look like this: ```ruby Vagrant.configure("2") do |config| config.vm.box = "hashicorp/bionic64" config.vm.provision :shell, path: "bootstrap.sh" end ``` 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