Setting up a LAMP on a Virtual Box
An almost step-by-step tutorial

First steps

Before starting to set up the Development environment it is recommended to do the following comfort steps:

Update the Ubuntu

Press Alt+F2 and type: gnome-terminal

To update Ubuntu type the following commands, give your password upon asked and always answer Y if you have to choose.

$> sudo apt-get update $> sudo apt-get upgrade $> sudo reboot Update and restart

The VM now will restart.

It’s not necessary to reboot, I just found that sometimes it prevents some problems which may stem from sequential Linux kernel updates.

Install VirtualBox Guest Additions

Attach the VBoxGuestAdditions.iso (which is located in the Installation folder of the VirtualBox. For Windows it is something like "C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso") to the VM. You can do it through the VM’s Devices menu. When it’s done press Alt+F2 and open the terminal again and type the following commands:

$> cd /media/V*TAB* $> sudo VBoxL*TAB* $> sudo reboot Install additions

After reboot you can freely resize the VM’s window like any other application window. The Ubuntu’s desktop will apply the new desktop size.

Install some very handful application

Sometimes it is necessary to do your job in terminal window, so some sort of navigator and editor application may come in handy.

Open the terminal and do the following:

$> sudo apt-get install mc joe The Midnight Commander

OPTIONAL: make your life easier

Due this is only a development environment installed on a virtual machine, it is not hard to recognize it won’t (and must not) function as a production web server. So why not just simply switch off some annoying features you don’t even need?

Turn off power management

If you need screensaver, then set it on your HOST. On the GUEST choose:

  • System > Preferences >Power Management

    On the “On AC Power” tab choose “Never” for both options.

  • System > Preferences >Screensaver

    Take out the checkbox from both options.

Auto log-in

If you are the only one who will work on this VM and you don’t want to login every time you boot, you can set auto login at:

  • System > Administration > Login Screen

    After unlock the window by giving your password, choose the “Log in as [developer (developer)] automatically”. Of course the ‘developer’ will be you username.

Don’t ask my password every time I do sudo

If you don’t want to type your root password every time you do some system-sensitive action in the terminal window you can tell the system that you are a reliable user. Open terminal window and type:

$> cd /etc/sudoers.d $> sudo mcedit developer

In the editor type the following:


Then press F2 to save the file and F10 to exit the editor. And once again the ‘developer’ is your actual username.

The only thing you have to do is to change the file permissions:

$> sudo chmod 0440 developer