VirtualBox is a multi platform and open-source virtualization tool for Windows, Linux, Mac OS X, and other operating systems, that lets you create virtual disc units in which you can install a guest operating system within the one you normally use on your computer, using it. Parallels Desktop 16. Parallels Desktop is, without doubt, one of the most popular virtual machine.
Learn about virtual machines and how you can use Vagrant and VirtualBox to set up a local Ubuntu installation.
I've gotten to the point in my web development career where I can no longer avoid the words VirtualBox, Vagrant, and Docker. Thanks to my friend Timm Stelzer, I finally got over my fear of the unknown and delved into the world of virtual machines via Vagrant and VirtualBox.
Now that I've finally used them, I can see how fun and useful they are, and since I've just set everything up myself in 2017 with the most up-to-date installations I could find, I can share what I've learned with you.
Prerequisites
The only prerequisite to this article is command line knowledge, and it is mandatory. This article that I wrote, How to Use the Command Line, will tell you everything you need to know, from moving around directories, creating files, and
ssh ing into servers. If you're not familiar with any of that, please read the aforementioned article.
Goals
In this tutorial, we will learn:
Introduction
VirtualBox is basically inception for your computer. You can use VirtualBox to run entire sandboxed operating systems within your own computer.
Vagrant is software that is used to manage a development environment. Through the command line, you can grab any available OS, install it, configure it, run it, work inside of it, shut it down, and more.
Using VirtualBox and Vagrant, you can simulate the production environment of your app or website. For example, if you're using Digital Ocean or AWS to run a Virtual Private Server (VPS) in the cloud running Ubuntu, PHP, and MySQL, you can install your local version to have all the same versions of that software, while keeping your own computer's software untouched. This can reduce and eliminate bugs and errors that result from trying to develop code for a production server on an environment that does not match.
In this tutorial, we're going to install Vagrant and VirtualBox, and install Ubuntu Server. We're going to connect to the Ubuntu server though
ssh to confirm that everything is running properly.
After this tutorial, learn to install a LAMP server on the environment we create.
Step 1 - Install Virtual Box and VagrantInstall VirtualBoxWhat Is Virtual Box App For Macbook
Go to the VirtualBox download page, choose your operating system (Windows or macOS) and download and install the software.
I clicked OS X and the download started.
Install Vagrant
Go to the Vagrant download page, choose your operating system (Windows or macOS) and download and install the software.
Again, I chose Mac OS X.
What Is Virtual Box App For Macbook ProStep 2 - Install Ubuntu Server with Vagrant
Create a directory for your virtual host to live. I created a VirtualMachines directory (which will potentially contain all of my virtual machine installations), and made a new directory within called ubuntu for this specific installation to live. The whole path is as follows:
![]()
Your path will be slightly different for Windows, using
C:/ , but otherwise will be the same idea.
Install Ubuntu Box
You can Discover Vagrant Boxes via the Vagrant Cloud.
ubuntu/trusty64 is the most popular box (machine), with nearly 30 million installs and updated within the last day. This is the one we'll be using.
In Terminal (Mac) or Git Bash (or whatever shell you're using on Windows), type the following to install Ubuntu Server 14.04.
After a few moments, this will be the output to let you know it's successful.
Mac Os Download For Virtualbox
Now initialize the new
vagrant in your VirtualMachines/ubuntu directory with the init command.
Finally, get Ubuntu up and running with the
vagrant up command.
When you see 'Machine booted and ready!', everything is good to go!
Fixing Guest Additions Error
This is great, and all set up. However, you may have gotten this error:
This might not be a problem, but let's make sure it doesn't become a problem. First, use the
halt method to shut down your currently running Vagrant.
Let's quickly install a plugin called
vbguest to fix this error.
It will run through some more commands, and most likely the above error will still persist. Let's reload the Vagrant machine with the
reload command.
Now the errors will be gone.
What about VirtualBox?
Looks like we didn't use VirtualBox for anything at all. But go ahead and open up the VirtualBox application. This is what you will see running:
As you can see, VirtualBox is letting us know that Ubuntu is running properly. We don't really need to know much more about it at this point.
Step 3 - SSH into Ubuntu
Now we have this Ubuntu operating system set up on our computer, but how do we access it? Just like you would access any remote Linux server through the command line, you will do the same with Vagrant. Run
vagrant ssh to securely enter the Ubuntu virtual machine.
When you login, you will see something along these lines.
You're in! You now have a complete Ubuntu Server installation running through VirtualBox on your computer, and you're connected to it. Type
exit at any time to exit out of the server, and vagrant halt to shut it down.
Conclusion
Here is a review of the commands we used with Vagrant today.
Note: All these commands must be done locally from the directory in which you want the virtual machine to be installed, except
vagrant box add .
As a review, VirtualBox is the software that runs the operating system, and vagrant will give you the methods to manage them. You can also think of vagrant as a package manager that has a repository of different operating systems to use.
Vagrant and VirtualBox can be used to create a local environment that matches the production environment of your server.
Move on to Part 2: Setting up LAMP (Linux, Apache, MySQL, and PHP) from the Ubuntu Server environment we created, and how to access it from your local computer.
VirtualBox is open-source software for virtualizing the x86 computing architecture. It acts as a hypervisor, creating a VM (virtual machine) where the user can run another OS (operating system).
The operating system where VirtualBox runs is called the 'host' OS. The operating system running in the VM is called the 'guest' OS. VirtualBox supports Windows, Linux, or macOS as its host OS.
When configuring a virtual machine, the user can specify how many CPUcores, and how much RAM and disk space should be devoted to the VM. When the VM is running, it can be 'paused.' System execution is frozen at that moment in time, and the user can resume using it later.
History
VirtualBox was originally developed by Innotek GmbH, and released on January 17, 2007 as an open-source software package. The company was later purchased by Sun Microsystems.
On January 27, 2010, Oracle Corporation purchased Sun, and took over development of VirtualBox.
Supported guest operating systems
Guest operating systems supported by VirtualBox include:
Using Virtualbox On Mac
Install Oracle Virtualbox On Mac
CamelCase, Emulator, Software terms, Virtual, VMware
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |