All you have to do is know where VirtualBox is installed, change the path to it below, then also change the name of the virtual machine (VM) you want to autostart below.  Here, upon boot up, I have one of my local development servers auto start “vm1”, which is a Ubuntu web server with a few Symfony projects.

cd "C:\Program Files\Oracle\VirtualBox"
vboxmanage startvm "vm1"

Fast, easy and reliable so if your server restarts, you don’t have to worry about your server staying offline.


Log in to your server as root.  At the server’s command line, type “visudo”.

Scroll down file and add any usernames you want sudo access:
“new_user    ALL=(ALL) ALL”

Find out more about “sudo” here.


Virtual Box on Windows 10 suddenly throwing new error “VERR_LDR_MISMATCH_NATIVE”.

If you encounter this, deactivate your virus protection and firewall and try to restart.  Seems to work fine after turning virus protection back on again but whitelisting all Virtual Box apps should prevent this from happening in the future.  It’s confirmed that even though I use Avast for this particular server the same issue for McAfee and Norton have been reported.


On one of my separate dev servers I figured it was as good of a time as any to upgrade to Windows 10.  It was a seamless update, kudos to Microsoft, but when I started up Virtual Box instance running on it, my network adapters were throwing strange errors.  I won’t bore you with the details, I just expected it to work and escape the wrath of Microsoft’s omnipotent presence.

I actually uninstalled Virtual Box the reinstalled it, enough angry web developers out there said this fixed it.  It didn’t.  Then I had to fanangle the /etc/network/interfaces file AND the network adapter settings on each VM to get to work properly again.  Who’s to say it wasn’t the firewall on the Windows server and why am I running Ubuntu, Red Hat, Fedora and CentOS VMs on Windows 10, you might ask?  Because those are the flavors I encounter most on live sites, so I like to set up as close of an environment I will encounter on my host and Virtual Box has been so reliable to deploy a new virtual server in less than 20 minutes with everything you need — MySQL, Apache, PHP, and all the PHP libraries, Virtualmin, and Webmin all ready to go.

So for documentation purposes, if you upgrade to Windows 10 and expect Virtual Box to keep humming, you may run into a few hiccups, it took me over an hour to get it to be visible on my LAN and accessible again so I could dev locally.  I remember back in 2005 devving sites on remote servers thinking how slow it was, not devving your site locally first is like pushing a race car instead of driving it — without using your hands!  Oh well, I’m not the strongest server admin, I’m more about the software and systems, so here are my latest settings that got VB and all VMs to work.

Below, you will see how I have 3 servers on different local IP addresses, each with a different web project.  Here are all the main settings that are easy enough to duplicate if needed!  Bridged Adapter is key, but I was reminded that it must still be the second adapter, not the first.  Why?  Good question, perhaps someone with more technical knowledge could enlighten us all?!  Any insight would be appreciated!

Latest VM VirtualBox network interfaces adapter setting 1 Latest VM VirtualBox network interfaces adapter setting 2 Latest VM VirtualBox network interfaces adapter setting 3

 

Here’s the cat /etc/network/interfaces:  Latest VM VirtualBox network interfaces file configuration


Keep your dev servers separate from your workstation

Setting up a development server on your local network separate from the machine you write and crunch code is a great way to keep the machine you rely on to operate as fast as possible.  I never try to install any virtual machine on the same machine I need to write code and design databases on, even a quad core with 8 GBs of RAM will slow down pretty quickly.

Virtualbox, Virtualmin and MySQL database server

So, after installing Virtualbox on another PC, usually the most recently replaced PC that used to be my main computer, I prefer instead of selling it to use it as another dev server on my network.  I prefer to install Virtualmin and use that to help speed up the process of deploying another dev server in minutes.  Obviously, the “M” in L.A.M.P. is short for MySQL, and without a local database to interact with, you are sure to get frustrated with the time lags involved in working with a remote database server.  This is a “dev” environment, after all, so you need every advantage to keep things running fast.  Dev is usually 80% of all the work you put into a new site and system.

Virtualmin allows you to install a new database server, Git repositories, and a myriad of other modules that will help you duplicate your existing host environment.  Of course, you can also open this server to the outside world if you have static IP as well.  Virtualmin allows easy deployment of new servers quickly and reliably.

Failure to connect to MySQL database

Once you set everything up in Virtualmin and can access your site, you will be tempted to go and establish a connection to the site’s database and start devving.  You will likely run into an error message saying your connection isn’t allowed.  This is what happens when I try to connect to the site’s MySQL server directly to its IP through MySQL Workbench:

Failure to connect through MySQL Workbench to local Virtualmin database

You did everything right, you set up your database and user privileges, so what gives?!  Well, Virtualmin can get a little confusing, so go back to your Virtualmin console then click “Edit Database” then go to the “Remote hosts” tab.  Here, you need to put in your IP address, if you’re not DHCP on your local network and that’s where you need to access your database from, it’s best to type in a wildcard of your network, which for me and my local network IPs are in the range from 192.168.1.1 – 192.168.1.255.  By entering the wildcard “192.168.1.%” this will allow any connection within the 192.168.1  IP range to access your database.

Virtualmin - open local IP to connect to your dev server databaseYou won’t have to restart MySQL, just go back to MySQL Workbench or whatever tool you’re using to access your database and see if it works now:

MySQL Workbench Virtualmin Database success screenshotSo, when you think you know where the proper settings are, in Virtualmin, this is something that often gets overlooked.