Article

Quick Tip: Get a Homestead Vagrant VM Up and Running

By Bruno Skvorc

This quick tip will help you get up and running with a brand new Homestead Improved Vagrant VM.

  • to find out about Vagrant and why you should use it, see this post.
  • Homestead Improved is based on Homestead, but has the added benefit of not forcing you to deal with SSH keys, doesn’t get installed globally, is more cross-platform friendly, and comes with a helper script to auto-configure the shared folders.
  • I recommend creating a new Homestead Improved VM for every new project, and this tutorial will follow such a practice.

Prerequisites

You need:

The tutorial assumes you’ll be using a bash-like terminal; Git Bash if on Windows (comes with Git Tools).

Getting Started

The following 3 commands are all that’s necessary for starting a new Homestead Improved VM instance on any operating system (obviously, replace my_project with your desired folder name):

git clone https://github.com/swader/homestead_improved my_project
cd my_project; mkdir -p Project/public
bin/folderfix.sh # this is optional!

The first two clone the project and enter the newly created folder.

The third one executes the folderfix script which shares the project’s folder with the Code folder inside the VM. That means you can edit files inside the project folder (my_project) and they’ll be reflected inside the VM, and vice versa. This allows you to use your main computer’s text editor / IDE to edit the files of a project inside the VM. You can also do this manually by editing the folders field in Homestead.yaml.

Add New Sites

There are two steps to adding every new site into a Homestead VM.

Step 1: Set up etc/hosts

etc/hosts is a file present on every operating system. On Windows, it’s in C:/Windows/System32/drivers/etc/, on OS X and Linux it’s in /etc/hosts. Edit it as an administrator (one easy way to do this is to run a text editor like Sublime Text as Administrator) and add in an entry like this for every application you intend to develop:

192.168.10.10 homestead.app

Replace homestead.app with your desired domain name, or just add in multiple domain names. For example, I have this in my own hosts file:

192.168.10.10 homestead.app
192.168.10.10 test1.app
192.168.10.10 test2.app
192.168.10.10 test3.app

This means I can access each of these domains in the browser via http://homestead.app, or http://test1.app, etc.

Step 2:

For every domain you defined in the above step, you need to add a sites mapping. Open the file Homestead.yaml in the cloned copy of the Homestead Improved repo, and add a pair for each. The default is:

sites:
    - map: homestead.app
      to: /home/vagrant/Code/Project/public

This means http://homestead.app (if you added it to etc/hosts in the step above) will look for index.php in the folder /home/vagrant/Code/Project/public inside the VM. You can add this file while outside the VM, too, by simply creating a Project/public folder in the root of the cloned Homestead Improved VM, and adding index.php in there – this is the same as adding it inside the VM into the aforementioned location, because the folders are shared.

You add new sites by adding new map/to pairs (as many as you wish):

sites:
    - map: homestead.app
      to: /home/vagrant/Code/Project/public
    - map: test.app
      to: /home/vagrant/Code/test

Booting Up and SSHing

Once all the sites have been added, boot the VM with:

vagrant up

Go inside the VM with:

vagrant ssh

Once inside, you can use the VM as if it were a regular production or development linux server.

Ports and Blackfire

Homestead comes with Blackfire pre-installed. It’s a very powerful profiler for PHP apps which inspects code into great detail and draws complexity graphs which help you speed up your apps. If you have an account, uncomment the blackfire lines in Homestead.yaml and put your data in there.

If you want to open additional ports, like for example port 5000 for Heroku, uncomment the ports part of Homestead.yaml and add in the values, like so:

ports:
    - send: 5000
      to: 5000

Database Access

Homestead comes with MySQL pre-installed. Its user is homestead and its password is secret. To connect to it from the outside operating system (Homestead does not have PhpMyAdmin installed), use a tool like Sequel Pro or the MySQL Workbench and specify the following parameters:

  • server / port: 192.168.10.10 / 3306 or 127.0.0.1 / 33060
  • user: homestead
  • pass: secret

The default homestead database should show up when you connect.

Conclusion

You should now be able to quickly set up a new VM instance for every new app you intend to build. This will allow you to seamlessly follow along with all our tutorials. Please let me know in the comments below if any of the above steps are unclear or could/should be simplified.

Common Problems

No input file specified

This means that the server in the VM cannot find the index.php file in the folder you specified under the sites block in the Homestead.yaml file. Often, this is because you added a new site when the VM was already provisioned. To fix this, exit the VM if you’re inside it, and run vagrant provision.

If this doesn’t help, it means you have a wrong mapping in the sites block, so double check to make sure there are no typos and that the folder inside the VM really exists.

Alternatively, if you’re working on a Symfony2 app, Symfony2 by default uses the web folder instead of public to host index.php. That’s why Nginx cannot find the file inside the VM. To automatically get around this problem, in Homestead.yaml under sites specify an additional value: type, like so:

sites:
    - map: homestead.app
      to: /home/vagrant/Code/Project/public
      type: symfony

This will automatically use a different serving script.

  • https://twitter.com/dmathisen36 dmathisen

    Great post, and I know this is setting up Homestead, but I used a similar Vagrant / VirtualBox setup and used PuPHPet (https://puphpet.com/) to set up our VM. Worked out really well.

    • http://www.bitfalls.com/ Bruno Skvorc

      Cheers. We’ve dealt with PuPHPet before (see http://www.sitepoint.com/tag/puphpet/) but it’s been known to fail rather often. Homestead is more standardized, being Laravel-endorsed, and always works. But definitely, tools like PuPHPet and Vaprobash are priceless when you need to change things up.

      • https://twitter.com/dmathisen36 dmathisen

        Yeah, I’ve had issues with version upgrades, etc. So it’s definitely not perfect. I’m not familiar with Homestead… will have to check it out.

  • saim

    Great tutorial! I’m new to Vagrant and Laravel Homestead. Been using Laravel for about a year. Server booted up first go. Thanks.

    I assumed you then install laravel through composer to $DIR/myapp. Then you can visit the welcome page at http://myapp.com:8000/ however I ended up with “No input file specified.”

  • http://www.bitfalls.com/ Bruno Skvorc

    You should install Laravel via Composer into the Code folder, did you do that? If you did, not sure, it should work, I use this procedure every day.

    See the error logs of Nginx inside Homestead with `sudo less /var/log/nginx/myapp.com-error.log` and press SHIFT+G to go to the bottom of the file. It should tell you which path it’s looking for the input file in.

    • saim

      Hi Bruno,

      My mistake – I had incorrectly declared my ‘folders’ path. Thank you for your quick reply and again, the great tutorial!

      Thanks again!

      • http://www.bitfalls.com/ Bruno Skvorc

        No problem, glad you liked it!

        • Yoram

          Hi Bruno, how do I view this error log? I’m pretty new to Nginx and also receiving “No input specified”, even after installing laravel via composer. Any help would be greatly appreciated, quite stuck atm… :/

          • http://www.bitfalls.com/ Bruno Skvorc

            No input specified means that there simply is no index.php file at the location mapped in your folders fields. The log file is as /var/www/log/nginx inside your VM (go inside it with vagrant ssh)

    • Tanveer

      how should i install laravel via composer into the code folder and where it is mentioned in the article? i am having the “no input file specified”.

      • nelson

        I’m having the same problem. I’m so close!!! But there is no Laravel directory in /code

        Any advice?

        • http://www.bitfalls.com/ Bruno Skvorc

          Create one.

      • http://www.bitfalls.com/ Bruno Skvorc

        Gentlemen, this is just a VM. The fact that the same person who made Laravel made it just unfortunate – it has nothing to do with Laravel. You install Laravel into this the same way you install anything else into it – just install into the folder specified in your folders field, make sure the index.php file is in that folder. If the folder doesn’t exist, create it, simple as that.

  • Phyo Thu Aung

    when I do “vagrant up”, I got an error saying “the shared folder guest path must be absolute”. any idea why?

  • DaHaiz

    hi bruno! first thanks for your efforts in homestead improved and for this nice tutorial. got only a little question: in your tutorial you start a new project from scratch and cloned your repo, but how would you integrate homestead improved in an existing app (where we already have a git repo)? Thanks in advance very much for your answer,
    Simon

  • Nicholas Loomans

    I get “The box ‘laravel/homestead’ could not be found.” when running with the latest version of Vagrant for Ubuntu 14.04. The solution was to manually download the latest version from Vagrant and install that, then `vagrant up` worked.

  • http://www.e-sites.nl Jasper van der Hoeven

    I followed the steps on my windows machines but got a “/vagrant/scripts/serve.sh: no such file or directory” message. I solved it by running:

    vagrant ssh

    sudo su –

    ln -ls /home/vagrant/Code/scripts scripts

    After that the error was gone. Hope this helps people with the same problem.

    Also make sure you enable the virtualisation setting in your BIOS to prevent “default: Error: Connection timeout. Retrying…” messages.

  • http://w3guy.com Agbonghama Collins

    Am using Windows, how will I do the folder/path mapping in homestead.yaml ? Mind you, with Windows file path varies from Linux.

    Got vagrant working but can’t get passed the path mapping.

    • http://www.bitfalls.com/ Bruno Skvorc

      Works out of the box for me, I’m on Windows, too. What’s the problem?

      • http://w3guy.com Agbonghama Collins

        I installed homestead in C:VMvagrant_boxesHomestead

        I created a htdoc folder relative to the Homestead folder above where all my project will be hosted.

        Here is my homestead.yaml file.


        ip: “192.168.10.10”
        memory: 2048
        cpus: 1

        folders:
        – map: C:VMvagrant_boxesHomesteadhtdoc
        to: /home/vagrant/Code

        sites:
        – map: homestead.app
        to: /home/vagrant/Code/hybrid

        variables:
        – key: APP_ENV
        value: local

        Mind you, i do get the following errors after doing vagrant up.

        default: Waiting for machine to boot. This may take
        default: SSH address: 127.0.0.1:2222
        default: SSH username: vagrant
        default: SSH auth method: private key
        default: Warning: Connection timeout. Retrying…
        default: Warning: Connection timeout. Retrying…
        default: Warning: Connection timeout. Retrying…
        default: Warning: Connection timeout. Retrying…

        • http://www.bitfalls.com/ Bruno Skvorc

          Do you have virtualization enabled in your BIOS?

  • Julius Koronci

    Too bad that Homestead uses Nginx..I tried to run a symfony project but ended up playing with how to replace the .htaccess file..otherwise a great post..although I couldn’t run the imporved box on Ubuntu so had the use the original from laravel

    • http://www.bitfalls.com/ Bruno Skvorc

      They’re identical. The improved box uses the original box.

  • Tanveer

    Most likely you incorrectly declared ‘folders’ path in Homestead.yaml file.

  • El Rhazal Oumaima

    hi ! thanks for that awesome tetorial =)
    please i need a help … :(
    i followed alll the steps , and everything went good , until o arrived to the last step ==> http://myapp.com:8000/ , but it says :
    Not Found
    HTTP Error 404. The requested resource is not found.

    Please help me , what should i do ?

  • http://wildfact.com/ Sanjay Ojha

    For me wired thing is happening, Bruno can you help me.
    During vagrant up my Homestead.yml have following :

    ip: “192.168.10.10”
    memory: 1024
    cpus: 1

    folders:
    – map: D:/app
    to: /home/vagrant/code
    – map: D:/app/laravel
    to: /home/vagrant/code/laravel
    – map: D:/app/myapp
    to: /home/vagrant/code/myapp

    sites:
    – map: homestead.app
    to: /home/vagrant/code/laravel/public
    – map: myapp.dev
    to: /home/vagrant/code/myapp

    variables:
    – key: APP_ENV
    value: local

    —–
    I was assuming that 192.168.10.10 will serve the content from “D:/app” from my host machine which is mapping to ” /home/vagrant/code” on my guest machine.

    I also assumed that homestead.app will server content from “D:/app/laravel/public” from my host machine but here mapping is from “D:/app/laravel/” to “/home/vagrant/code/laravel”, Which I think is fine as I have defined in site configuration.

    What happening is 192.168.10.10 is mapping to “D:/app/laravel/public” and homestead.app or http://www.homestead.app:8000 is throwing error “server not found”. Also http://www.myapp.dev:8000 is serving content from to “D:/app/laravel/public” while myapp.dev:8000 is working fine.

    So what could be the real cause of this mismatches ?

    • http://www.bitfalls.com/ Bruno Skvorc

      You shouldn’t use 192.168.10.10 in the URL, use only virtualhost domains – I can’t help you with the IP since it’s unpredictable what will get served first. Please provide the full URLs and full errors of each.

  • Steve

    Perhaps an extra tip (I really hate those port numbers): Use socat! :) I’m on macos so I can’t be sure it will work everywhere, but here’s what I do: `sudo ifconfig lo0 172.16.190.1 alias`. This gives the loopback interface an extra IP. Then you can socat port 80 on that one to whatever your vm webserver is running on. Eg: `sudo socat TCP4-LISTEN:80,bind=172.16.190.1,fork TCP4:127.0.0.1:8000 &`. (I’m assuming the same port as the article here). Final step: Instead of using 127.0.0.1 in the hosts file, use 172.16.190.1 and pronto, no more port number. Obviously the alias and socat need to be ran every time after you reboot, but still. Also: the IP I used is just something that I chose. You can pick whatever doesn’t interfere with your regular network settings. Hope this helps someone.

    • http://www.bitfalls.com/ Bruno Skvorc

      No need, just put the IP of the VM into hosts instead of 127.0.0.1 and problem solved

  • Ryan Kang

    Thanks for sharing your great tutorial. I followed your guide and worked fine. I have a question though. Laravel documentation says that I will have to put the ip address 192.168.10.10 on hosts file. However, you suggest 127.0.0.1 which is localhost. Is there any particular reason why you
    put this localhost ip address?

    • http://www.bitfalls.com/ Bruno Skvorc

      Outdated instructions, will fix. Either is fine – if you put localhost, your URLs will have to have :8000, otherwise they won’t.

  • jagtar s mundey

    I followed the same and was able to setup homestead quickly. Thanks for the easy setup way. I could not achieve same using official setup way.

    Just a note maybe for a noob like me is that composer should be run from within vm.

    I’m still wondering why actual homestead git offers with those src and scripts which are sort of not present in homestead_improved.

  • Nikees

    I did everything a couple of times with the same result:

    in chrome: ERR_CONNECTION_RESET

    I disabled my firewall without result

    yaml file:

    ip: “192.168.10.10”

    memory: 2048

    cpus: 1

    provider: virtualbox

    folders:

    – map: .

    to: /home/vagrant/Code

    sites:

    – map: homestead.app

    to: /home/vagrant/Code/Laravel/public

    variables:

    – key: APP_ENV

    value: local

    log from vagrant up command:
    ——————-
    C:homestead>vagrant up

    Bringing machine ‘default’ up with ‘virtualbox’ provider…

    ==> default: Importing base box ‘laravel/homestead’…

    ==> default: Matching MAC address for NAT networking…

    ==> default: Checking if box ‘laravel/homestead’ is up to date…

    ==> default: Setting the name of the VM: homestead_default_1437742901421_71372

    ==> default: Clearing any previously set network interfaces…

    ==> default: Preparing network interfaces based on configuration…

    default: Adapter 1: nat

    default: Adapter 2: hostonly

    ==> default: Forwarding ports…

    default: 80 => 8000 (adapter 1)

    default: 5000 => 5000 (adapter 1)

    default: 3306 => 33060 (adapter 1)

    default: 5432 => 54320 (adapter 1)

    default: 22 => 2222 (adapter 1)

    ==> default: Running ‘pre-boot’ VM customizations…

    ==> default: Booting VM…

    ==> default: Waiting for machine to boot. This may take a few minutes…

    default: SSH address: 127.0.0.1:2222

    default: SSH username: vagrant

    default: SSH auth method: private key

    default: Warning: Connection timeout. Retrying…

    default: Warning: Connection timeout. Retrying…

    default: Warning: Remote connection disconnect. Retrying…

    default:

    default: Vagrant insecure key detected. Vagrant will automatically replace

    default: this with a newly generated keypair for better security.

    default:

    default: Inserting generated public key within guest…

    default: Removing insecure key from the guest if its present…

    default: Key inserted! Disconnecting and reconnecting using new SSH key…

    ==> default: Machine booted and ready!

    ==> default: Checking for guest additions in VM…

    ==> default: Setting hostname…

    ==> default: Configuring and enabling network interfaces…

    ==> default: Mounting shared folders…

    default: /home/vagrant/Code => C:/homestead

    ==> default: Running provisioner: shell…

    default: Running: inline script

    ==> default: stdin: is not a tty

    ==> default: Updating to version c6cc6dd6070871f4b198ed39f76dd8047c116b02.

    ==> default: Downloading: Connecting…

    ==> default:

    ==> default: Downloading: 100%

    ==> default:

    ==> default:

    ==> default: Use composer self-update –rollback to return to version c43a39f733

    4ae3df968cd36a6eff0436bea0da75

    ==> default: Running provisioner: shell…

    default: Running: inline script

    ==> default: stdin: is not a tty

    ==> default: bash: /vagrant/scripts/serve.sh: No such file or directory

    The SSH command responded with a non-zero exit status. Vagrant

    assumes that this means the command failed. The output for this command

    should be in the log above. Please read the output to determine what

    went wrong.

    ———————

    I so like to learn this framework, but I lost 3 hours allready and I didn’t started yet… so frustrating everytime I wanted to learn something new. Please anyone an idea of what may going wrong?

    thx

    • http://www.bitfalls.com/ Bruno Skvorc

      When you clone homestead improved, inside the folder run: sed -i ” “s@map: .@map: $PWD@g” Homestead.yaml

      Then try running vagrant up again.

  • anonymous

    $ vagrant up

    ==> default: Successfully added box ‘laravel/homestead’ (v0.2.7) for ‘virtualbox’!
    There are errors in the configuration of this machine. Please fix
    the following errors and try again:

    vm:
    * The host path of the shared folder is missing: /var/www/myapp
    * The host path of the shared folder is missing: /var/www/myapp2

    how to fix the above?

    • http://www.bitfalls.com/ Bruno Skvorc

      Make sure the folders exist.

  • http://www.bitfalls.com/ Bruno Skvorc

    Note to all: the comments below are now probably irrelevant, as the article has been almost completely revamped.

  • Adil Shahzad

    Hi,
    I’ve installed everything but when i try to run the following commands
    vagrant up – It boots the vm which is okay but when i run a command
    vagrant ssh – It shows the following message:

    `ssh` executable not found in any directories in the %PATH% variable. Is an
    SSH client installed? Try installing Cygwin, MinGW or Git, all of which
    contain an SSH client. Or use your favorite SSH client with the following
    authentication information shown below:

  • Nikhil Dhiman

    that’s gr8,, as an s/w engineer you always have to see ur code as legacy and try to replace it with current cutting edge technologies.. But to do that how you actually write code, that’s make easy to migrate.

  • Ganapathi Vara Prasad

    I am new to this vagrant environment. Will the vagrant box is downloaded when the vagrant up is ran or should it be installed first??

    • http://www.bitfalls.com/ Bruno Skvorc

      Either way is fine. If you don’t have it, it will be downloaded.

  • marioo

    Almost everything works for me. I am on windows 10. Initial setup went perfectly.
    The problem is that no matter what I change on Homestead.yaml it does not make any changes in box. I’ve tried to add additional site but it runs the same script. I’ve tried to change the default one.. still pointing on the same directory.. If I totally bork yaml format the box won’t up.
    Any suggestions?

    • http://www.bitfalls.com/ Bruno Skvorc

      To apply changes, just exit the box and do “vagrant provision”. The provision process needs to be re-applied in order to apply changes to the yaml file. Let me know if it works

      • marioo

        It works now!
        I am still Vagrant noob and wasn’t aware of provisioning;]
        Great tutorial. I was fighting with Homestead few hours and then was able to run improved version in first try.
        Thx for help!

  • Chris Kavanagh

    Awesome! Thanks Bruno.

  • http://about.me/lauhakari Lauhakari [mikko]

    The “type: symfony”, why not just point the “to:” to the /web folder instead of /public?

    That’s how you do in the original homestead. I’m not really clear on how Homestead-improved is a better and simpler version from the original. :)

    • http://www.bitfalls.com/ Bruno Skvorc

      Type Symfony *is* from the original Homestead. I only added type: symfony-sulu. Compare the server setup and you’ll notice the differences. Most notably, settings related to app_dev.php and app.php, normalized URLs because of those files, and more.

  • Chris Peckham

    If you want to connect to the MySQL database on the Homestead box, then I think it is either on port 33060 via 127.0.0.1 (using port-forwarding) *or* on port 3306 (default MySQL) via 192.168.10.10.

    I’ve been unable to connect using the parameters as listed in the article, but both of the combinations above work for me.

    • http://www.bitfalls.com/ Bruno Skvorc

      Thanks for the feedback, amending now!

  • Reuben Helms

    This is probably due to the recent introduction of PHP7, but when I try this, just after nginx starts, I get ‘default: php5-fpm: unrecognised service’.

    Using `service –status-all`, I can see that php7.0-fpm is included, so the hi scripts probably need updating to use this instead of php5-fpm.

    Time to chase down the project on GitHub and submit an issue.

  • Damian Rossney

    Fix “Conclusion.”

    • http://www.bitfalls.com/ Bruno Skvorc

      Can’t believe no one noticed before :) Thanks!

      • Damian Rossney

        Just read your Jump Start PHP Environment (it led me here for more info). Very good book. Eminently practical. Just the sort of thing beginners need. I was reading it to solidify my understanding of using Vagrant for development environments, and I think you gave me a lot of confidence in that regard. Thank you!

        • http://www.bitfalls.com/ Bruno Skvorc

          Thank you, that’s so good to hear!

        • Eno

          Yes, I’m reading the same book and found it to be an excellent intro. Thanks Bruno. I hope you follow up with more related content.

  • Gabriel Machado

    Is the translation project still active? I wish to submit a translation in brazilian portuguese for this article.

    • http://www.bitfalls.com/ Bruno Skvorc

      Certainly, let us know when you have it ready and where you’d like to publish it!

  • Captain

    can you assist me to set my vagrant using IDE phpstorm? pls i need help

  • Jelle De Vos

    Is there a version of Homestead Improved that uses PHP 5.6?
    I checked out the commit before the one that upgraded to PHP7 but running vagrant up on that one gives php5-fpm: unrecognized service

  • Jelle De Vos

    Is there a php5 version of Homestead Improved?

    I tried using the commit before the one that upgraded to php 7 but running vagrant up on it gives me the following error: “php5-fpm: unrecognized service”.
    Thanks!

    • http://www.bitfalls.com/ Bruno Skvorc

      Hi Jelle,

      no PHP5 version, sorry. You can manually install PHP5 just like you would on a normal server, and then use php5-fpm, but I recommend against it.

      • Melissa Webster

        Hi Bruno – First, let me say “thank you!!!!” for providing a very thorough tutorial and this improved version of Homestead. I’ve been having a LOT of trouble with the original! I am curious if you could expand on why you recommend against installing and using PHP5(-fpm). Our production server uses php5 and I feel like it would be a smart move for me to use it in development and avoid some eventual incompatibilities. And, before you suggest it, I already tried to get them to upgrade the production server to 7…the best I could get was 5.5!

        • http://www.bitfalls.com/ Bruno Skvorc

          Hi Melissa – thanks!
          That’s a very tricky situation you’re in – 5.5 is already outdated and is not being updated any more. In fact, it’s only getting security fixes now, and not for long! In a couple of days, it’ll be 100% abandoned, so you’ll be at risk of running an incredibly outdated version in production. Just look at this chart: http://php.net/supported-versions.php

          5.6 would be better, as it will live longer, but since there’s almost no complications when upgrading to 7.0 (soon 7.1) because all the code from before is compatible with the new version, so no code changes are necessary, I don’t see why not push harder to get them to go to 7+. Just show them the link and they should see the error of their ways.

          Now, that said, even if this doesn’t work, you can sill install version 5.5 on Homestead Improved, you just have to do it manually – when you’re SSHed into the machine, you can install on it what ever you want, even PHP 4 if needed, just use it like a regular VM and put stuff in there. Then, change the fpm version by going into `/etc/nginx/sites-available/MYSITE.conf` and switch out php7.0-fpm in the socket part for which ever version you installed. It should work just like that.

          • Melissa Webster

            Bruno, thank you! This is the perfect answer. I will go back in on Monday and push a little more for that jump to 7 having a little more info on hand (…why i/we didn’t find that ahead of time is beyond me…), and if that doesn’t work, I have a fallback. :)

  • Eno

    Where does the ip address come from in the site address, 192.168.10.10, is that my computers ip address or the vm’s? Can I rename this address to homestead.test instead of .app?

    • http://www.bitfalls.com/ Bruno Skvorc

      The IP address is the VM’s. You can change it in Homestead.yaml. You can rename the site to anything you want, as long as you also configure this in the sites block of Homestead.yaml, and in your etc/hosts file.

      • Eno

        Thanks Bruno. Is the IP address arbitrary? Can I use any IP address? I’m reading your book at the moment which is a big help.

        • http://www.bitfalls.com/ Bruno Skvorc

          Technically yeah but it’s best practice to keep it in the 192.168.x.x space. Thanks for reading :)

  • http://www.bitfalls.com/ Bruno Skvorc

    I have removed all references to Laravel, sorry, leftovers. You run folderfix by typing `./folderfix.sh` in the VM’s cloned folder (so outside the VM, on the main machine).

  • M S i N Lund

    $ mkdir Project/public
    mkdir: cannot create directory ‘Project/public’: No such file or directory

    Never, ever, ever, do any of these “simple one million-step”- command line tutorials just work.

    • http://www.bitfalls.com/ Bruno Skvorc

      mkdir -p Project/public should do fine. -p means “recursive”, so “create folder and all parent folder if missing”. Changed in post, too, thanks for the heads up.

  • Eno

    I’m a little confused with the database. You say we can connect with the default database. Is there only one? What if I have three sites and want one db each?

    • http://www.bitfalls.com/ Bruno Skvorc

      There are several ways to create new databases:

      1. add them into Homestead.yaml (bottom section) before running vagrant up. If your machine is already upped, exit the VM (if you’re SSHed into it), then add the database names to Homestead.yaml, and then run vagrant provision. This will add the missing databases.

      2. SSH into the VM, and create them the old fashioned way, through the MySQL command line.

      3. Connect to the MySQL server with a tool like MySQL workbench or Sequel Pro, and create as many DBs as you want through the UI of the tool of your choice.

      Bottom line, treat the box as just a regular server – do on it whatever you want. Install different PHP versions, add databases, start working with Go instead of PHP – doesn’t matter.

      • Eno

        Thanks for your reply Bruno. I’ll try a couple of those out.
        Do you only need to SSH into the vm if you need to install something? What are the use cases for entering the vm?

        • http://www.bitfalls.com/ Bruno Skvorc

          You’ll enter the VM to use Composer and install PHP packages into your app, you’ll do it to inspect your VM and run unit tests, to create new projects, to inspect logs, and more. As you play around with it more, you’ll find more use cases. You need to keep in mind that the entire environment is now contained in that one VM, and only the source code is visible outside it, on the main machine. Thus, anything you need to do *around* the app will likely have to be done inside the VM. More on that in the rest of the book, in any case :)

          • Eno

            Ok, thanks again Bruno.

  • captain_sensible

    $vagrant up

    hangs at: default: SSH auth method: private key

    • http://www.bitfalls.com/ Bruno Skvorc

      More info please. Which OS are you using, which VM provider, etc?

      • captain_sensible

        still playing with it , this might be one problem : VT-x/AMD-V hardware acceleration is not available on your system.
        Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.

  • Nguai al

    Hi Bruno.
    What is the simplest way for me to demonstrate the outputs of my web application to others who are working remotely?
    I am assuming that IP address is only visible for me. Or is my assumption incorrect?

  • micheal hands

    I HAVE FOLLOWED MOST OT THESE CRAPS AND GOT SCAMMED.I EVEN SEE SOME OF THEM REWRITING WHAT I WROTE ON THE NET.MOST OF THIS PEOPLE INTEND GIVEN THEMSELVES FUNNY NAMES,TELLING YOU FAKE TESTIMONIES AND FOR YOU TO BE AWARE OF THIS AND BEWARE OF THAT ARE BUNCH OF CRAPS AND SCAMS.THE ONLY MAN YOU CAN ACTUALLY TRUST ON HACKING IS apexhackers4187@gmail.com I WOULD HAVE BROUGHT HIM RIGHT HERE IN THE STATES IF POSSIBLE.HE DID WHOLE LOT OF THINGS WHICH I WONT REALLY MENTION HERE BUT MOST OF WHAT HE DID FOR ME WAS HELP ME OUT.HE HELPED ME GET BACK MY JOB AND MARRIAGE.HE IS GREAT AND I MET HIM OVER THE INTERNET JUST AS EVERY OTHER PERSON HAS TESTIFIED BUT HE IS ACTUALLY REAL AND VERY GOOD HACKER.I AM STILL MUCH INDEBTED TO HIM.I WANT TO LET YOU ALL KNOW THAT YOU DONT HAVE TO TRY ANYBODY ELSE EXCEPT THIS DUDE.HIS EMAIL CONTACT IS apexhackers4187@gmail.com

  • tumbacoco

    Hi bruno is there anything different about how this would be performed now in 2016 or is this guide still effective?

Recommended
Sponsors
Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in Front-end, once a week, for free.