Pages

Showing posts with label virtualization. Show all posts
Showing posts with label virtualization. Show all posts

May 1, 2014

Vagrant: "Development environments made easy."

I've been using VirtualBox as my go-to hypervisor provider. It's usually how I test out Linux ISOs I've downloaded to see if they run before I load said ISO into a USB device. Another thing I've recently used virtual machines for is to create a development server to, for example, host a LAMP stack, which I prefer not to install into my main OS. I do like to use the same tools when developing stuff across the board. This is where Vagrant shines! You basically create a Vagrant VM to get a LAMP server running but use the tools on your host OS (e.g. text editor, IDE, etc.) to edit the web pages that are served by the VM.

Vagrant is a great tool for spinning up VirtualBox VMs as fast as possible. You create a Vagrantfile, a file which holds the settings on how to setup a VM; things like which base box to base your VM off of, to the networking setup or to the shared folders the VM will have with the host machine. The Vagrantfile is written in Ruby code but it is very easy to grok and you don't need to learn the language to create one.

In this post, I gloss over my usage of Vagrant.

February 23, 2014

A Basic CentOS LAMP Server Build in VirtualBox

I've been using Fedora for more than a month now and I wanted to create a virtual machine (VM) in VirtualBox which I can use for learning web development. I usually go for a Debian based VM but this time, since I'm on Fedora, then I decided to go with CentOS.

I have used CentOS before so I knew that it took a bit of effort to get it up and running. In this post, I put down my notes into how I built a CentOS VM for a basic LAMP server.

Creating the CentOS guest

The CentOS OS is easy enough to install. Just download the ISO image from their site; I chose to use the CentOS-6.5-x86_64-minimal.iso image. It's just a matter of using the downloaded image as the DVD media for the VM. Installation is straightforward and fast and finishes in under 30 minutes.

NOTE: In my setup, I have set 2 network interfaces -- one for Host-only adapter and another for NAT adapter. At this time of posting, I suggest to set Host-only as adapter 1 and NAT as adapter 2 because I've run into some issues with the network interfaces. Host-only interface is for accessing the VM from the host machine while the NAT interface takes care of the connection to the Internets.

Enable networking in the CentOS guest

Network interfaces are down by default in CentOS [1]. So there is a need to do some manual configuration. To show the interfaces, use command ip addr show. Since my setup has 2 network adapters set in VirtualBox, the result of that command shows eth0 and eth2, for the Host-only adapter and the NAT adapter, respectively. The configuration files for these are located in /etc/sysconfig/network-scripts/ifcfg-ethX where X is the interface number.