Sunday, June 9, 2013

VirtualBox, CentOS, Zend Server CE Oh My! - Part 1

To get started in my Laravel experiment I needed a decent development environment. Since I have been using CentOS at work lately I decided this was the OS I would use for my development environment. Being mediocre at best with Linux this presented more of a challenge than I normally enjoy when working on a personal project. This is the kind of sacrifice I make for everyone reading this, so you are welcome!

I had a very specific environment I wanted to build. The newest CentOS version 6.4 on VirtualBox using a private virtual network running Zend Server CE 6.0.1 for the Apache and PHP portions of the stack.

VirtualBox Specs
So one of my pet peeves with VirtualBox as a development VM that most people seem to just accept and shrug off as normal is port forwarding. I despise port forwarding! Something about needing to remember another set of numbers that have perfectly good defaults just irks me to no end. It might be my inability to constantly remember things that are unimportant or something else in my brain. Regardless I think we all now understand I don't want to do it.

While using VMWare it configures the virtual network adapter by default to have it's own subnet so I get a unique network between my guests and my host. It also facilitates giving me access to the outside network (internet) from the guest OS. Having a fair understanding of networking I may use some incorrect terms here, please forgive me. By default on VirtualBox it is usually a bridged connection which is fine. I get an IP address from the network I am on for my guest OS. This is great until I have no network or I switch networks. Now my static little network has been disrupted and I must reconfigure. Sure I could update my hosts file. But why should I need to? So I want this in my life when using VirtualBox, subnet that never changes between the host and guest OS and internet access for the guest.

Come to find out, this is pretty easy to do. It seems no one else is bothered as much by this so you rarely see info on how to set it up.


Open your preferences in VirtualBox and go to the Network section.




Select the "Add host-only network (Ins)" button.



The new host-only network will be listed, select the Edit button.



This will open up the adapter settings which should have default settings for IPv4. No need to change unless you have a reason to. I left IPv6 blank as I don't have a reason to use it.



Next You will want to choose the DHCP Server tab and add the settings for it. I suggest copying the IPv4 Address for reference unless you can remember it easily enough.

  • Check Enable Server
  • Paste or enter the IPv4 address into the Server Address field that will be used for DHCP
  • Enter the Server Mask value which matches your Adapter settings
  • Enter the DHCP start and end addresses. These will be delegated to the guest like any other DHCP server would.




Now VirtualBox is setup and ready to use this host-only network for any guest OS you install. When setting up your guest OS you will assign this adapter to one of the network interfaces in the individual VM settings for networking as shown.



That's it! That is everything I ever wanted from VirtualBox but never knew existed.

CentOS Installation


I am going to cheat here. I followed a very detailed blog to finally get my CentOS installation right. I tried a few variations from these instructions and failed one way or another each time. So I am linking you straight to where I had success. If I attempt my own install again not using these instructions I will also link to that but for now here is what I did to get my CentOS install just right.

>>>> Best CentOS VirtualBox Installation Instructions EVER! <<<<

That concludes Part 1, next I will detail getting Zend Server CE setup along with the Virtualhost settings.

No comments:

Post a Comment