Debian系统中如何安装KVM虚拟机
作者:贺bujak_491 | 来源:互联网 | 2014-05-27 21:08
今天实验了一下kvm的远程安装。同时开了3个kvm给朋友实验。同时安装系统。cpu的占用没有超过3%.同时这个服务器还运行着web服务。kvm可性能还是不错的。远在网通机房的一台服务器,amd浩龙的双核amdcpu,支持硬件虚拟技术,在上面实施kvm虚拟机记录如下:de
今天实验了一下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
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
推荐阅读
-
本文详细介绍了如何搭建一个高可用的MongoDB集群,包括环境准备、用户配置、目录创建、MongoDB安装、配置文件设置、集群组件部署等步骤。特别关注分片、读写分离及负载均衡的实现。 ...
[详细]
蜡笔小新 2024-11-20 18:28:16
-
本文详细介绍了如何在ARM架构的目标设备上部署SSH服务端,包括必要的软件包下载、交叉编译过程以及最终的服务配置与测试。适合嵌入式开发人员和系统集成工程师参考。 ...
[详细]
蜡笔小新 2024-11-20 14:13:38
-
-
本文记录了在 Vulnhub DC3 靶机上的渗透测试过程,包括漏洞利用、内核提权等关键步骤,并总结了实战经验和教训。 ...
[详细]
蜡笔小新 2024-11-17 20:50:03
-
在 FreeBSD 环境下,安装 PHP GD 库时可能会遇到一些常见的问题。本文详细介绍了从配置到编译的完整步骤,包括解决依赖关系、配置选项以及常见错误的处理方法。通过这些详细的指导,开发者可以顺利地在 FreeBSD 上完成 PHP GD 库的安装,确保其正常运行。此外,本文还提供了一些优化建议,帮助提高安装过程的效率和稳定性。 ...
[详细]
蜡笔小新 2024-11-09 17:50:30
-
数字图书馆近期展出了一批精选的Linux经典著作,这些书籍虽然部分较为陈旧,但依然具有重要的参考价值。如需转载相关内容,请务必注明来源:小文论坛(http://www.xiaowenbbs.com)。 ...
[详细]
蜡笔小新 2024-11-08 10:55:29
-
技术日志:Ansible的安装及模块管理详解 ...
[详细]
蜡笔小新 2024-11-03 15:01:47
-
如何将PHP文件上传至服务器及正确配置服务器地址 ...
[详细]
蜡笔小新 2024-10-31 15:32:47
-
RancherOS 是由 Rancher Labs 开发的一款专为 Docker 设计的轻量级 Linux 发行版,提供了一个全面的 Docker 运行环境。其引导镜像仅 20MB,非常适合在资源受限的环境中部署。本文将详细介绍如何在 ESXi 虚拟化平台上安装和配置 RancherOS,帮助用户快速搭建高效、稳定的容器化应用环境。 ...
[详细]
蜡笔小新 2024-10-28 22:49:28
-
本文介绍了SIP(Session Initiation Protocol,会话发起协议)的基本概念、功能、消息格式及其实现机制。SIP是一种在IP网络上用于建立、管理和终止多媒体通信会话的应用层协议。 ...
[详细]
蜡笔小新 2024-11-21 17:42:08
-
问题描述现在,不管开发一个多大的系统(至少我现在的部门是这样的),都会带一个日志功能;在实际开发过程中 ...
[详细]
蜡笔小新 2024-11-21 15:14:45
-
本文详细介绍了如何正确设置Shadowsocks公共代理,包括调整超时设置、检查系统限制、防止滥用及遵守DMCA法规等关键步骤。 ...
[详细]
蜡笔小新 2024-11-20 20:41:33
-
本实验旨在对比Telnet和SSH两种安全通信协议的服务差异,并通过搭建服务器和使用Wireshark抓包工具进行详细分析。 ...
[详细]
蜡笔小新 2024-11-18 14:10:59
-
本文介绍了Linux系统中的expect命令及其在自动化任务中的应用,同时探讨了Python中的pexpect模块如何实现类似功能。 ...
[详细]
蜡笔小新 2024-11-18 13:38:40
-
本文详细介绍了如何使用Layui框架实现动态和静态数据表的分页功能,具有较高的实用性和参考价值。适合需要开发管理后台的开发人员参考。 ...
[详细]
蜡笔小新 2024-11-17 10:11:33
-
在 Ubuntu 中遇到 Samba 服务器故障时,尝试卸载并重新安装 Samba 发现配置文件未重新生成。本文介绍了解决该问题的方法。 ...
[详细]
蜡笔小新 2024-11-12 13:02:23
-
贺bujak_491
这个家伙很懒,什么也没留下!