Creating a Debian VirtualBox VM
Posted: January 7th, 2011 | Author: Godwin | Filed under: Debian, Mac, Virtual Box | Tags: Bridged network, debian, debian 5, MacOSX, openssh, Parallels rant, sshd, Virtualbox, vm | No Comments »In the past, I used to use Parallels 5 for my VM needs (and I still do). Recently I have found out that in order to install the Parallel Guest Tools on the latest Ubuntu (10.10); I have to upgrade Parallels from version 5 to 6. Since Ubuntu updates every 6 month, it means that there is a good chance that I have to update Parallels every year on order for the latest version of Ubuntu to work. I have decided to check out VirtualBox and see how well it works with my Development environment.
To create a basic Debian VirtualBox image:
- Grab the latest netinst image
- For typical development use, I don’t think one will use more than 8GB of disc space.
- Use the Guided hard disc setup and use the whole drive
- Deselect everything else and only install Standard System
- Install GRUB to your bootloader
- Go through the system setup and reboot
- Install OpenSSH server by apt-get install openssh-server
- Run apt-get upgrade
- Run apt-get update
- Do a ACPI Shutdown via the Machine menu or run shutdown now
- Edit the VM’s Settings via the Oracle VM VirtualBox Manager
I typically set:- Hardware clock in UTC time. This is to make sure that clocks are in sync so things like ssh won’t misbehave.
- Disable Audio
- Change Network -> Adapter 1 -> Attached to: Bridged Networking
- Disable the Ports (both serial and USB)
- Leave Shared Folders option unset, I just use SSH for everything.
- Reboot, Login
- Run ifconfig, the ip address will now be in your home network’s subnet (for me it is 192.168.123.0). So you can ssh into the machine via ssh username@ipaddress
- Shutdown again and select Export Appliance under File in the VirtualBox Manager. Now, whenever you need a debian vm, you just have to import the appliance. At this stage. I also highly recommend you take a snapshot of the image before you do any tinkering.
- Start the machine again, if you want to give the vm a static IP run nano /etc/network/interfaces
Replace1
2allow-hotplug eth0
iface eth0 inet dhcpwith (IP Address and Gateway adjusted to taste)
1
2
3
4
5
6iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1Run /etc/init.d/networking restart
- Next time, you can start the Virtual Machine via commandline by using VBoxHeadless -startvm “machinename”
Leave a Reply
You must be logged in to post a comment.