- 论坛徽章:
- 0
|
Installing a Debian Virtual Machine using Microsoft Virtual PC
by Ben Field of
Northwest Business Technology Group
Modified by Kylin Ming
Introduction
My goal for installing a Linux distribution as a virtual machine was to quickly build a testing server for my internet application development work. The idea was to connect to the virtual machine using
Samba
, and use it to run my test web server and database.
My system is a whitebox running Windows XP Professional. It's not new, but the hardware isn't too out of date for most productivity applications running normally (that is, not within a virtual machine). It holds a 600 MHz Pentium III processor and 384 MB of RAM. As of this writing, it is due for an upgrade.
//add by kylin
My system is a workstation running Windows Vista. It has 4G DDRII RAM and has 160G+250G SATAII Hard Disk.
My reason for choosing the
Debian
distribution is that I've heard numerous first-hand reports that it has a simple install, excellent security updating (somewhat irrelevant in my virtual machine context, admittedly, but good practice), and superior package management.
My reason for choosing a virtual machine over a separate box is that
Microsoft Virtual PC 2004
costs $125, while a separate box would cost $200 at an absolute minimum. Also, I don't want to take up space in my chic office with a clunky old dev server box.
//add by kylin
Microsoft Virtual PC 2007 is free now!:)
Installing Microsoft Virtual PC 2004
Installing Virtual PC itself was so simple, there's nothing to write about.
Creating the Virtual Machine
Creating the virtual machine and virtual hard drive was also incredibly simple -- it's really straightforward functionality of the application. I created these in their default location in My Documents/My Virtual Machines, and chose to allocate 64 MB of RAM to the virtual machine, which is ample for Debian under the conditions in which I'm using it.
//add by kylin
I set up 512M RAM for the Virtual Machine.
Installing/Configuring the Debian Server
I first went to the Debian website and tracked down a net install package of the distribution. I found it at
http://www.phy.olemiss.edu/debian-cd/
. As the notes at this URL indicate, this isn't your typical net install: it is a base package, that will function fully without downloading a lot of stuff -- but it doesn't include anything extra. Total size of the .iso image was 186M.
NOTE: If I were to do this again, I would go with the
full-CD image
, not the net install. Read the Problems section below for why -- but come back to read the next few paragraphs which apply either way.
Typically, one would burn this image to a CD. With Virtual PC, however you can start the virtual machine, click the CD menu, and choose Capture ISO Image. Navigate to the image, and Virtual PC treats that image as your CD drive! It's faster than any CD drive, since it's on the hard drive, and it works well, without any special steps or problems to iron out. This is only one of many killer MSVPC features.
The virtual machine boots to the image and installation begins.
//add by kylin
The URL provided above is still available now.
It asks a variety of simple questions, and reaches the partitioning step. Since this is a brand new virtual machine, there are not partitions -- just a bunch of free space (the same as the drive on which the virtual hard drive resides). If you don't know anything about partitions, this step could be tricky -- but even then, probably not. I just followed the instructions and created two partitions.
One was a plain old default Linux partition. I have a small hard drive, so I made mine only 5000MB, but that was plenty for my purposes. This partition I made bootable.
NOTE: According to something I read somewhere (I forget), Debian, with all possible packages installed (not even possible because of conflicts) would take up 2000MB. Adding my development files, I had a good idea of what kind of hard drive size I'd need.
The other is a swap partition. I know nothing about the size of Linux swap files, so I went for 512MB, which might be overkill. In any case, this is not a big deal, because MSVPC virtual hard drives don't allocate actual space unless the space is used -- they shrink and grow within the limits of their partitions without eating up white space for allocation. I had to change the type of the swap partition (82) to make it a swap partition rather than a standard default Linux partition.
The install process also asks for which special hardware packages to install as part of the kernel. It was unnecessary for me to install any, especially since it found my network connection by default (as will yours, thanks to MSVPC and your compatible network card), and I had no other special hardware.
After installing from the CD and rebooting (I had to CD->Release the ISO Image in order to avoid booting again from CD), the configuration program launches, asks some time zone and password questions, and begins the package download process.
At some point in here (I don't know where) Debian finds the network hardware, talks to the same DHCP server used by my workstation, grabs its own IP, and is a fully functional node of the local network. And it's only a virtual machine. Quite impressive.
Next, it asks from where to install packages. Because this was a net install, I had to choose FTP servers.
NOTE: As I mentioned before, if I were to do this again, I'd go with the
full-CD image
, not the net install.
I initially had trouble finding an FTP mirror -- the one I tried (a sourceforge mirror) didn't work. One of the standard debian.org mirrors worked great. I then added a couple more FTP sites for the system to choose from during its install.
It asks whether to use security.debian.org for security updates. Why, of course.
The program then asks whether to run "tasksel," a program for choosing useful packages based on specific roles the installation might play. This is the way to go for my purposes. I chose no End-user roles because I didn't plan on using this system for Linux browser compatibility testing and I didn't want to bloat my installation. For Servers roles, I chose file server, mail server, conventional unix server, and web server. For Development roles, I chose C and C++. As tempting as it was to add Cyrillic or Polish localization, I skipped those options too.
Next, a program called "dselect" is launched for specific package management. The instructions are cryptic, and frankly, I didn't have time to figure them out. If I had, I might have saved myself the grief of hours wasted trying to do without it. I think most open-source software is great -- but why on earth are we still using programs like this to choose operating system options? It's ludicrous. Three guesses why Microsoft owns the desktop market ... and don't say "unfair business practices."
Next, the setup program downloads and installs packages in less time than it takes to go to lunch and read the front page, the business section, the life section, and do the word jumble in the the Seattle Times. For me, the download itself was less than 70MB packed, which doesn't take too long at 88kB/s.
The first time I did this, I came back and the screen was black. I did a Ctrl-Alt-Delete within the Virtual Machine, and it rolled back its hard work and took me back to the time zone step. I could have just hit "K" or some other pointless key, forcing it to redrawn the screen, but I had no way of knowing -- Microsoft has terrible documentation (as usual) and nonexistent end-user support. I'll say this for Linux and its open source companions: documentation and support are excellent.
The downloader ran into a variety of problems, but the installer was able to grab files from other servers.
The install itself takes longer -- a few hours maybe, on my machine. It periodically asks no-brainer questions, then attempts to set itself up to perform the roles selected previously.
When finished, I found my IP address, browsed to it in my web browser on my workstation, and up came the default index.html on the web root.
Success, right? Well ...
//add by kylin
Just follow up the requirements displayed when you install the system.
Now, you successfully install the debian on your virtual machine.
![]()
Problems
The following problems may have something to do with installing on a virtual hard disk, but I can't see why:
Every time I installed, a "could not find configuration file" error occurred -- right in the middle of my install screen, without any further explanation.
Basically, the "tasksel" program doesn't work as expected. For example, it does not install Samba under the file server option, even though it says it will.
Choosing too few "tasksel" options (may be the issue which) results in dozens of extremely useful programs not being installed -- but this is nothing one might expect from what the installer has to say about itself. It took me several extra hours to patch up the functionality holes left by installing too few packages.
If I were to do this again, I would download the standard Debian CD image all at once and install it, bloated and all, just to save myself time looking for standard included packages.
//add by kylin
The screen resolution options are limited in Virtual PC for Linux, so you’e better use the resolution 800*600 pixels. If you set to 1024*768, the screen may displayed incorrectly. And the depth must be set to 16, otherwise you can’t log in under graphic interface.
//How to change the screen resolution
Start the virtual machine.
After initialization process end, CTRL+F1 to login as root.
Vi /etc/X11/xorg.conf
I
Replace 24 with 16
SHIFT+:
Input wq to save change
Reboot
Another snapshot :)
![]()
Samba
Because tasksel didn't work as expected, I went ahead and installed Samba separately and added a username/password for myself using smbpasswd. This is ultimately what the relevant portion of my Samba configuration file looked like:
[webroot]
comment = Web Root
path = /var/www
read only = no
valid users = ben
Memory and processor problems
While using my new virtual development machine, I ran into memory and processor load issues. The latency for working on files over Samba using the virtual machine was enough of a problem that I abandoned this option in favor of installing Apache/PHP/MySQL using the Win32 binaries, directly into Windows XP. I don't doubt these problems could be solved by added memory and a current processor -- after all, I barely have enough juice to run Windows XP.
Conclusion
The three conclusions I brought away from this experiment are these:
1. Microsoft Virtual PC (formally Connectix Virtual PC) is a phenomenal program. This is no half-baked utility, nor is it unstable bloatware. This is an efficient and rock-solid application that does everything you'd imagine and much, much more.
2. Debian's installation system, while robust, has a long way to go in terms of usability. And the installer interface suffers from at least half a dozen run-on sentences, which never fail to make me grumpy.
3. Installing a virtual Linux system is a fairly quick, very clean and exceptionally convenient way to put together an ultra-realistic testing/development server for internet application development -- but only if you have enough speed and memory in your machine.
About the author
A native to the Pacific Northwest,
[url=javascript:mail('ben%20nwbtg%20com');]Ben Field[/url]
studied computer science at the University of Portland, in Oregon. He has worked with the internet and other business automation technologies for over seven years, and focuses on the effective integration of business workflow with online technology.
Ben's past work experience includes freelance internet and information technology consulting, as well as employment with a variety of technology groups, including Intel's computer telephony automation team and the popular SecurityPortal.com information security website.
At Northwest Business Technology Group, Ben leads
website development
and other
internet technology
projects, and provides
HIPAA security compliance
consulting.
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/22778/showart_278371.html |
|