One, why install a virtual machine, why choose QEMU
My system has 3 Linux systems, these systems are independent, sometimes, I want a computer, can be more realistic simulation of two, this time we can install a virtual machine. In fact, if you really have a lot of money, you might consider buying a computer so that you don't have to emulate it. Can simulate two servers to do a lot of things, such as testing heartbeat, etc.
Why Choose QEMU? My CPU (Pentium series) does not support full virtualization, so can not install KVM, and so on, previously tried to dress up Xen, but the installation is too complex, has not been installed successfully. QEMU installation is simple, try not to put time on the machine, or install a virtual machine, wasting time
Second, install the Kqemu acceleration tool
installation, you can be installed through the system of Yum, Apt-get, Pacman Software management tools to install, if the download source inside no words, in choosing to compile themselves, because their own compiled programs, updating the system, will not automatically update, these dependencies can not be maintained, When prompted by this. So file cannot find, the. So file can not find, it is very depressed, it is best to use the own management tools to install.
Tar zxvf kqemu-1.3.0pre9.tar.gz
CD Kqemu-1.3.0pre9
sudo su
./configure
Make
Make install
Third, install QEMU
When installing QEMU, be aware that if the source is installed, QEMU is the default installation of GCC is 3 series, and now generally is gcc4, so when installing the attention, because I use Yum search is a download source, I directly installed
Yum Install Qemu
Iv. installing the Virtual machine system
1, to start the Kqemu, if not start, will slow you crazy, after the start, reluctantly acceptable
Modprobe Kqemu
2. Create a virtual machine system image file. img
mkdir QEMU
CD QEMU
QEMU-IMG Create Ubuntu.img 4G
3. Prepare the installation disk or installation source
Whether you install a virtual machine from a CD-ROM installation or from a hard disk, you must prepare the installation program. You can download the. iso file from the Internet and burn it to a disc
Qemu-hda/home/zhangy/qemu/ubuntu.img-cdrom/dev/cdrom-boot d-m 256
-hda is to specify the img file that will be used, install Ubuntu system disk, you can think of it as a plate.
-cdrom is ready to give CDROM drive, here is the program where the system is installed, can be in the CD, I would like to also be on the hard disk, on the hard drive no try, interested friends can try
-boot d, is the specified system from the CD-ROM boot,-boot c local Boot
-M 256, specifying the memory of the allocation group virtual machine
If you start the installation from the hard disk, personal feeling should be like this qemu-hda/home/zhangy/qemu/ubuntu.img-cdrom/path-boot c-m 256
This allows you to install it step-by-step, and one thing is that when you install a virtual machine in this way, partitions can be randomly divided, so don't worry that the hard drive will be dropped by mistake. All actions are performed on the. img image file that you created.
Five, prepare the network connection
Virtual Machine Network protocol go to the TUN/TAP mode, is to support the kernel, to see if your kernel is not supported
[Email protected] ~]$ Ls/lib/modules/2.6.18-194.26.1.el5/kernel/drivers/net/tun.ko
/lib/modules/2.6.18-194.26.1.el5/kernel/drivers/net/tun.ko
If you have a lot of cores under your/lib/modules, you're not sure which kernel your system is using, you can use UNAME-A to see
Modprobe Tun
Lsmod |grep Tun
If there is content, the description succeeds. And then in the making/etc/qemu-ifup
Vim/etc/qemu-ifup
Sudo/sbin/ifconfig $192.168.18.1
sudo route add-host 192.168.18.6 Dev $
chmod a+x/etc/qemu-ifup
Don't forget to give it permission to execute
Six, start the virtual machine
Qemu-hda/home/zhangy/qemu/ubuntu.img-boot c-localtime-m 256-net Nic-net Tun
Take a look
Installing virtual machine qemu Kqemu
under Linux