My aim was to setup a minimal ubuntu installation that I can use occasionally on my office system which is running windows XP for playing around when I get some time. The primary requirement was that it should be small on memory and disk. So, I decided to go for Ubuntu mini in a headless virtual box server
- I started out by obtaining the Ubuntu (10.10 Maverick) mini iso.
Can be got from – http://archive.ubuntu.com/ubuntu/dists/maverick/main/installer-i386/current/images/netboot/mini.iso - Download the latest version of Virtualbox (4.04), previous versions had some bugs with DHCP so, I downloaded the latest one though I had an old one
Can be got from – http://download.virtualbox.org/virtualbox/4.0.4/VirtualBox-4.0.4-70112-Win.exe - Install Virtualbox and create a virtual machine called Mini with the configuration
1. 128 MB memory
2. 8 GB expanding harddisk
3. Add a cd drive and connect that to Mini.iso
4. Create two network connections.
1. NAT – used for internet access
2. Host only Adapter – used for communication between Windows XPhost and Ubuntu guest - Now start the virtual machine and proceed with the installation of Ubuntu. We should get the base system ready upon which we will be installing additional components.
- Once the base system is ready we have to install shh. This can be done by giving the command
Sudo apt-get install ssh
This will install open shh server and client - Now the next step is to start the shhd
Type sudo sshd
I got the error messagetutysra@dev-test:~$ sudo sshd
sshd re-exec requires execution with an absolute path
tutysra@dev-test:~$What this means that we should use the full path to start sshd
Now usewhichto find the executable and run ittutysra@dev-test:~$ which sshd
/usr/sbin/sshd
tutysra@dev-test:~$ sudo /usr/sbin/sshd
tutysra@dev-test:~$ - Now try connecting from the local host to check the connection
tutysra@dev-test:~$ ssh localhost
tutysra@localhost's password:It should prompt for the password.
- Now we should configure the host only adapter
We will assign it a static IPOpen –
/etc/network/interface
Vi /etc/network/interface and add the following lines
iface eth1 inet static
address 192.168.56.101
netmask 255.255.255.0 - Now restart networking services
sudo /etc/init.d/networking restart
We are all done now.
- Come to windows. Install putty if you don’t have one and from – http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe
Try connecting to the Ubuntu guest by giving the hostname as 192.168.56.101 and port as 22.
Now we should be able to log in into the guest - Now the next step is to run Virtualbox in the background using headless mode.
First we should shutdown the machine which is already running and close virtualbox. - Open a cmd prompt in windows and type
"C:\Program Files\Oracle\VirtualBox\VBoxHeadless.exe" -startvm Mini –p 8000This will start the Virtualbox server in the background. Give it some time for the OS to boot.
- Now we can connect using putty and start using the system
In case if the Ubuntu guest doesn’t boot property or if you cannot connect using putty by ssh, we can always use windows remote desktop connection for connecting to the machine and debugging it.
This can be done by opening Remote Desktop Connection fromPrograms -> Accessories -> Remote Desktop Connection
In the hostname filed type – 127.0.0.1:8000This will allow you to see the Ubuntu guest console from where you can correct the issues if there are any and continue with the normal process.
- The system can be shutwon from commandline by issuing the command
"C:\Program Files\Oracle\VirtualBox\VBoxManage" controlvm Mini poweroff
We can put these commands in a batch file for easy execution.
We can also start the virtual machine at startup or as a service so, that looks very clean (no command windows lying open on the screen)
I would be happy to help if you are struck. Leave me a comment if you have any request/suggestion or if you like this.