Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Development Tools

Kyle Haynam
Kyle Haynam
15,017 Points

What is all this stuff I'm installing on my computer?

So I'm trying to learn a PHP framework. Laravel seems to be a decent choice, but In picking laravel, I'm supposed to install Homestead, which requires vagrant, which requires virtual box, which requires composer. And I only realized I need a framework because I've already installed MAMP, which does very similar things to these other programs. Right?

My question is, what does all this stuff do? Am I installing multiple copies of everything on my machine (php, apache, mysql)? Will there be conflicts? I don't really understand what it means to set up an environment and am worried I'm just cluttering up my machine or changing settings I'll wish I hadn't messed with.

I understand that PHP needs a server to run, so I'm turning my mac into a server of sorts, but after that words like dependency manager, package manager, version control all get muddy. Each one of them must do something with the files on my computer.

Is there a chart or simple analogy that would help me understand all of this better? I'm much more of a visual learner, so anytime I find myself in terminal, I freak out a little, knowing I'm not going to learn anything, but am just trusting that I need to type certain commands to get up and running.

Has anyone else been down this road?

2 Answers

William Li
PLUS
William Li
Courses Plus Student 26,865 Points

Well, what you're actually installing on your machine is just VirtualBox and vagrant, everything else aren't.

Here's how they all fit together.

  • VritualBox is a piece of software to let you run Operating System in Virtual Environment, The OS itself isn't actually installed in your system, it's just a big image file stored in VirtualBox readable format, when VirtualBox reads that file, it'll know how to properly boot up the OS in virtual environment. That image file grows larger as you download and install more stuffs while running the OS in Virtual environment; but in a nutshell, it's just an image file, no more no less.
  • vagrant is just a terminal frontend for VirtualBox image. Why vagrant is great? Because by default, if you install some OS like Ubuntu, it gives you a full-fledged GUI interface alt text; but lots of time, developer doesn't need a GUI, all he needs is a Command Line interface, that's exactly what vagrant provides, a Command line frontend to talk directly to VirtualBox image via local ssh. Well, vagrant has alot more features than just that, vagrant is really good at setting up the identical environment between your server and local development machine, this can really help minimize surprises by testing everything locally and make sure all working ok before deploying to server.
  • Homestead is nothing more than a setup script to tell vagrant where to download the OS image and how to properly setup the virtual environment, once its setup is done. Everything you do within vagrant, such as installing Composer, Laravel, MySQL, whatever, are all within the virtual environment powered by VirtualBox. It has 0 impact on your local system, that means even if you totally screw up in Homestead, like destroying an entire MySQL database, or deleting every files in the system. ALL you have to do is delete that one VirtualBox image file in your system, re-download Homestead, and you'll start afresh.

That's what's so good about VirtualBox + vagrant, together they provide an isolated easy-to-replicate sandboxed environment for you to play with, whatever you do in the sandbox has no impact on local system, likewise, whatever you have on local system has no impact on the sandbox.

Kyle Haynam
Kyle Haynam
15,017 Points

That does help. And I managed to get everything installed and working, but not without some hiccups. It's hard to troubleshoot that stuff when you don't know what most of it means.

Colin Marshall
Colin Marshall
32,861 Points

Thanks for this William Li! I was having trouble wrapping my head around vagrant, and I found this really helpful.

William Li
William Li
Courses Plus Student 26,865 Points

you're welcome, Colin, glad you find it useful. :)

Kevin Korte
Kevin Korte
28,109 Points

It is a bit confusing for sure. I can't even explain it all.

A lot of them do similar things, yes. I have Vagrant, Composer, virtual box, homestead, Xampp, Ruby and Rails, Python, Git all installed on my computer.

I've had zero issues with the installations messing with anything. I have also installed Gulp, Grunt, Bower, and the likes as well. The good part is most of these programs do not have a GUI, or a very limited one at that so their size is very small.

I'm not sure how else to answer this except that I've installed this stuff on two different computers successfully.