下载中心 | 网站地图 | 站内搜索 | 加入收藏

安恒公司 / 技术文章 / 安恒公司网管员手记 / debian远程安装kvm虚拟机

2007-01-13 刘世伟  阅:    下页:
debian远程安装kvm虚拟机
今天实验了*kvm的远程安装。 同时开了3个kvm给朋友实验。 同时安装系统。
cpu的占用没有超过3%. 同时这个服务器还运行着web服务。kvm可性能还是不错的。


远在网通机房的*台服务器,amd浩龙的双核amd cpu,支持硬件虚拟技术,在上面实施kvm虚拟机记录如下:
debian的etch版本下是没有kvm虚拟机的,所以*把内核模块源码和kvm从sid版本拿过来。
**修改 /etc/apt/sources.list 将sid源加进去。然后aptitude update
只要安装几个包就行了:
aptitude install kvm kvm-source
装完后马上修改sources.list.降回到etch版。

现在开始给etch的2.6.18生成kvm内核模块

执行modules-assistant 在图形界面下,选中kvm模块,然后build并安装内核模块。就这么简单,kvm就安装好了。


下面就是系统的安装了。

kvm使用的是qemu虚拟机程序。qemu有2种方式支持远程运行。
1.字符模式,就是把串口关联在当前的控制台,这样在安装的时候,安装程序的内核参数增加*个console=ttyS0
 就可以让安装程序的控制台使用串口,也就是kvm运行的终端。
2.vnc模式 就是远程机器连接到本机的某个vnc端口,作为kvm的显示器,vnc模式灵活性比较大,我们采用这种模式。

*生成*个5G虚拟磁盘。
qemu-img create /home/kvm.img  5000000
debian.org下载 安装盘 netinst.iso
启动安装过程
kvm -vnc 210.51.xx.xx:0  -hda kvm.img -cdrom netinst.iso -boot d
然后,通过vncview或者rdesktop连接远程的210.51.xx.xx:0,
进行正常的安装过程。


安装结束从新启动kvm,去掉光驱 不启动图形界面 后台运行。
kvm -nographic -daemonize  -hda kvm.img

然后就可以用ssh对它进行远程登录管理了。

只要备份和复制kvm.img就可以把这个虚拟计算机移动到其他的物理服务器上

cpuinfo和dmesg信息如下:
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 6
model           : 2
model name      : QEMU Virtual CPU version 0.9.0
stepping        : 3
cpu MHz         : 2000.261
cache size      : 512 KB
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu de pse tsc msr pae mce cx8 sep pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm up pni
bogomips        : 4167.30
TLB size        : 1024 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

hdparm -tT /dev/hda

/dev/hda:
 Timing cached reads:   1886 MB in  2.00 seconds = 945.10 MB/sec
 Timing buffered disk reads:  100 MB in  3.04 seconds =  32.94 MB/sec


hdparm -i /dev/hda
/dev/hda:

 Model=QEMU HARDDISK, FwRev=0.9.0, SerialNo=QM00001
 Config={ Fixed }
 RawCHS=5952/16/63, TrkSize=32256, SectSize=512, ECCbytes=4
 BuffType=DualPortCache, BuffSize=256kB, MaxMultSect=16, MultSect=off
 CurCHS=5952/16/63, CurSects=5999616, LBA=yes, LBAsects=6000000
 IORDY=yes, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2
 DMA modes:  mdma0 mdma1 *mdma2
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 udma3 udma4 udma5
 AdvancedPM=no
 Drive conforms to: ATA/ATAPI-5 published, ANSI INCITS 340-2000:  ATA/ATAPI-4 ATA/ATAPI-5 ATA/ATAPI-6 ATA/ATAPI-7

 * signifies the current active mode


dmesg:
Bootdata ok (command line is root=/dev/hda1 ro )
Linux version 2.6.18-4-amd64 (Debian 2.6.18.dfsg.1-11) (waldi@debian.org) (gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)) #1 SMP Wed Feb 21 14:29:38 UTC 2007
BIOS-provided physical RAM map:
 BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
 BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
 BIOS-e820: 00000000000e8000 - 0000000000100000 (reserved)
 BIOS-e820: 0000000000100000 - 0000000007ff0000 (usable)
 BIOS-e820: 0000000007ff0000 - 0000000008000000 (ACPI data)
 BIOS-e820: 00000000fffc0000 - 0000000100000000 (reserved)
DMI not present or invalid.
ACPI: RSDP (v000 BOCHS                                 ) @ 0x00000000000fa6a0
ACPI: RSDT (v000 BOCHS  BXPCRSDT 0x00000001 BXPC 0x00000001) @ 0x0000000007ff0000
ACPI: FADT (v000 BOCHS  BXPCFACP 0x00000001 BXPC 0x00000001) @ 0x0000000007ff002c
ACPI: MADT (v000 BOCHS  BXPCAPIC 0x00000001 BXPC 0x00000001) @ 0x0000000007ff0938
ACPI: DSDT (v001   BXPC   BXDSDT 0x00000001 INTL 0x20060912) @ 0x0000000000000000
No NUMA configuration found
Faking a node at 0000000000000000-0000000007ff0000
Bootmem setup node 0 0000000000000000-0000000007ff0000
On node 0 totalpages: 31322
  DMA zone: 3057 pages, LIFO batch:0
  DMA32 zone: 28265 pages, LIFO batch:7
ACPI: PM-Timer IO Port: 0xb008
Intel MultiProcessor Specification v1.4
    Virtual Wire compatibility mode.
OEM ID: BOCHSCPU Product ID: 0.1          APIC at: 0xFEE00000
Processor #0 6:0 APIC version 17
I/O APIC #1 Version 17 at 0xFEC00000.
Setting APIC routing to physical flat
Processors: 1
Allocating PCI resources starting at 10000000 (gap: 8000000:f7fc0000)
SMP: Allowing 1 CPUs, 0 hotplug CPUs
Built 1 zonelists.  Total pages: 31322
Kernel command line: root=/dev/hda1 ro
Initializing CPU#0
PID hash table entries: 512 (order: 9, 4096 bytes)
time.c: Using 3.579545 MHz WALL PM GTOD PIT/TSC timer.
time.c: Detected 2000.180 MHz processor.
Console: colour VGA+ 80x25
Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
Checking aperture...
Memory: 120128k/131008k available (1930k kernel code, 10492k reserved, 868k data, 176k init)
Calibrating delay using timer specific routine.. 4012.01 BogoMIPS (lpj=8024036)
Security Framework v1.0.0 initialized
SELinux:  Disabled at boot.
Capability LSM initialized
Mount-cache hash table entries: 256
CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
CPU: L2 Cache: 512K (64 bytes/line)
CPU 0/0 -> Node 0
SMP alternatives: switching to UP code
Freeing SMP alternatives: 28k freed
ACPI: Core revision 20060707
ACPI: setting ELCR to 0800 (from 0a00)
ACPI Error (hwacpi-0179): Hardware did not change modes [20060707]
ACPI Error (evxfevnt-0084): Could not transition to ACPI mode [20060707]
ACPI Warning (utxface-0154): AcpiEnable failed [20060707]
ACPI: Unable to enable ACPI
BIOS bug, local APIC #0 not detected!...
... forcing use of dummy APIC emulation. (tell your hw vendor)
SMP disabled
Brought up 1 CPUs
testing NMI watchdog ... CPU#0: NMI appears to be stuck (0->0)!
migration_cost=0
checking if image is initramfs... it is
Freeing initrd memory: 4893k freed
NET: Registered protocol family 16
PCI: Using configuration type 1
ACPI: Interpreter disabled.
Linux Plug and Play Support v0.97 (c) Adam Belay
pnp: PnP ACPI: disabled
usbcore: registered new driver usbfs
usbcore: registered new driver hub
PCI: Probing PCI hardware
PCI: Probing PCI hardware (bus 00)
PCI quirk: region b000-b03f claimed by PIIX4 ACPI
PCI quirk: region b100-b10f claimed by PIIX4 SMB
Boot video device is 0000:00:02.0
PCI: Using IRQ router PIIX/ICH [8086/7000] at 0000:00:01.0
PCI-GART: No AMD northbridge found.
pnp: the driver 'system' has been registered
PCI: Ignore bogus resource 6 [0:0] of 0000:00:02.0
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 1, 8192 bytes)
TCP established hash table entries: 4096 (order: 4, 65536 bytes)
TCP bind hash table entries: 2048 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 4096 bind 2048)
TCP reno registered
audit: initializing netlink socket (disabled)
audit(1173865286.592:1): initialized
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
Initializing Cryptographic API
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
PCI: PIIX3: Enabling Passive Release on 0000:00:01.0
Limiting direct PCI/PCI transfers.
Activating ISA DMA hang workarounds.
Real Time Clock Driver v1.12ac
Linux agpgart interface v0.101 (c) Dave Jones
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16450
pnp: the driver 'serial' has been registered
RAMDISK driver initialized: 16 RAM disks of 65536K size 1024 blocksize
pnp: the driver 'i8042 kbd' has been registered
pnp: the driver 'i8042 aux' has been registered
pnp: the driver 'i8042 kbd' has been unregistered
pnp: the driver 'i8042 aux' has been unregistered
PNP: No PS/2 controller found. Probing ports directly.
serio: i8042 AUX port at 0x60,0x64 irq 12
serio: i8042 KBD port at 0x60,0x64 irq 1
mice: PS/2 mouse device common for all mice
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
NET: Registered protocol family 8
NET: Registered protocol family 20
Freeing unused kernel memory: 176k freed
input: AT Translated Set 2 keyboard as /class/input/input0
Losing some ticks... checking if CPU frequency changed.
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
PIIX3: IDE controller at PCI slot 0000:00:01.1
PIIX3: chipset revision 0
PIIX3: not 100% native mode: will probe irqs later
PCI: Setting latency timer of device 0000:00:01.1 to 64
    ide0: BM-DMA at 0xc000-0xc007, BIOS settings: hda:pio, hdb:pio
    ide1: BM-DMA at 0xc008-0xc00f, BIOS settings: hdc:pio, hdd:pio
Probing IDE interface ide0...
ne2k-pci.c:v1.03 9/22/2003 D. Becker/P. Gortmaker
  http://www.scyld.com/network/ne2k-pci.html
hda: QEMU HARDDISK, ATA DISK drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
Probing IDE interface ide1...
hdc: QEMU CD-ROM, ATAPI CD/DVD-ROM drive
ide1 at 0x170-0x177,0x376 on irq 15
PCI: setting IRQ 11 as level-triggered
PCI: Found IRQ 11 for device 0000:00:03.0
eth0: RealTek RTL-8029 found at 0xc100, IRQ 11, 52:54:00:12:34:56.
hda: max request size: 512KiB
hda: 6000000 sectors (3072 MB) w/256KiB Cache, CHS=5952/255/63, (U)DMA
hda: set_multmode: status=0x41 { DriveReady Error }
hda: set_multmode: error=0x04 { DriveStatusError }
ide: failed opcode was: 0xef
hda: cache flushes supported
 hda: hda1 hda2 < hda5 >
hdc: ATAPI 4X CD-ROM drive, 512kB Cache, (U)DMA
Uniform CD-ROM driver Revision: 3.20
Attempting manual resume
kjournald starting.  Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
input: PC Speaker as /class/input/input1
piix4_smbus 0000:00:01.3: Found 0000:00:01.3 device
input: ImExPS/2 Generic Explorer Mouse as /class/input/input2
ts: Compaq touchscreen protocol output
Adding 184708k swap on /dev/hda5.  Priority:-1 extents:1 across:184708k
EXT3 FS on hda1, internal journal
loop: loaded (max 8 devices)
device-mapper: ioctl: 4.7.0-ioctl (2006-06-24) initialised: dm-devel@redhat.com

下页:   

相关文章
在win下安装debian的方式 - 13-06-30 - 阅读: 183714
kvm的qcow2的镜像文件的压缩 - 12-10-21 - 阅读: 232584
debian作无盘启动 - 08-11-24 - 阅读: 177064
debian lenny openvpn 不能启动 version_2.1~rc9-3 - 08-07-26 - 阅读: 171524
debian下的netflow工具 - 07-12-21 - 阅读: 195240
debian下的无盘linux系统安装要点 - 07-12-09 - 阅读: 214040
debian 系统时间和cmos时间 - 07-04-14 - 阅读: 171157
debian下安装qmail+clamav+webmail - 07-04-03 - 阅读: 238744
linux内核虚拟机 kvm - 07-01-05 - 阅读: 295850
在debian下用eaccelerator加速php性能 --安恒网管员手记 - 06-06-28 - 阅读: 304760
qmail+debian --安恒网管员手记 - 06-01-15 - 阅读: 265565
debian Etch版 010908312D230C5F 错误 - 05-12-31 - 阅读: 194612
debian下应用raid5提高数据安全性--安恒网管员手记 - 05-05-02 - 阅读: 307731
在debian下部署lamp - 04-07-11 - 阅读: 222722
在debian版linux下用pptp 实现VPN - 04-07-09 - 阅读: 511914
安恒网管员手记: 网卡启动安装 DEBIAN - 04-06-14 - 阅读: 222053
安恒网管员手记: debian之webmin - 04-05-12 - 阅读: 198124

Email给朋友 打印本文
版权所有·安恒公司 Copyright © 2004   axon.anheng.com.cn   All Rights Reserved    
北京市海淀区*体南路9号 主语国际商务中心4号楼8层 (邮编100048) 电话:010-88018877