When KVM installing windows, F8 key is not enable, so we need press ctrl + F8 instead.
安装准备
首先检查CPU是否支持安装KVM:英特尔VT或AMD-V处理器才支持安装虚拟机,可用命令查看:
$ egrep -o '(vmx|svm)' /proc/cpuinfo
输出下面的信息说明该CPU支持安装KVM:
vmx
vmx
安装KVM
(1) 安装软件包
sudo apt-get install qemu-kvm libvirt-bin virt-manager bridge-utils qemu-system
sudo apt-get install kvm qemu
sudo apt-get install virtinst python-libvirt virt-viewer virt-manager
sudo apt-get install bridge-utils
其中:virt-manager为GUI管理窗口,bridge-utils:用于网络桥接。
(2) 安装测试
执行下面的命令看KVM是否安装成功:
kvm -ok
输出信息:
INFO: /dev/kvm exists
KVM acceleration can be used
如果提示信息为:
INFO: KVM (vmx) is disabled by your B
IOS(KVM [vmx]被你的BIOS禁用)
HINT: Enter your BIOS setup and enable Virtualization Technology (VT)
则需要进入的BIOS设置界面,启用虚拟化技术[VT],设置步骤为:
进入BIOS后,选择ADVANCED,然后至 PROCESSOR CONFIGURATION进去找到,
INTEL (R) VIRTUALIZATION TECHNOLOGY ,设置成ENABLE,保存退出 。
验证KVM内核是否加载成功:
lsmod | grep kvm
输出为:
kvm_intel 47162 0
kvm 317577 1 kvm_intel
若KVM内核没加载执行下面命令加载:
$ sudo modprobe kvm
$sudo modprobe kvm-intel ( or kvm-amd )
证实KVM正常运行
virsh -c qemu:///system list
将输出:
Id Name State
如果提示你没权限操作,则需要将当前操作账户添加进libvirtd组,命令为:
sudo usermod -G libvirtd -a fdc
(4) 启动KVMGUI
virt-manager
(5) 确认libvirtld后台服务是否启动
sudo service libvirt-bin status
如下是修改完成后的网卡配置文件,具体配置步骤请往下看。
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).auto p128p1
iface p128p1 inet manual
# The primary network interface
auto br0
auto eth0
iface br0 inet static
address 103.111.246.17
netmask 255.255.255.92
network 103.111.246.18
broadcast 103.11.246.11
gateway 103.111.246.19
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 103.111.24.2
gateway 103.11.26.19
bridge_ports p128p1
____________________________________________________________________
Following is config network adapter steps:
1. check interface information.
fjxajey2a9@P10311246187188:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 6c:62:6d:7c:24:42
inet addr:103.11.246.187 Bcast:103.11.246.191 Mask:255.255.255.192
inet6 addr: fe80::6e62:6dff:fe7c:2442/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:392753 errors:0 dropped:0 overruns:0 frame:0
TX packets:197178 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:461455515 (461.4 MB) TX bytes:16359742 (16.3 MB)
Interrupt:46 Base address:0xc000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
virbr0 Link encap:Ethernet HWaddr 82:d7:f9:7f:7c:fb
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
fjxajey2a9@P10311246187188:~$
sudo cp /etc/network/interfaces /etc/network/interfaces.bak1
cd /etc/network
sudo vim interfaces
2. After opening the configure file, Following is the contents:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 103.11.246.187
netmask 255.255.255.192
network 103.11.246.128
broadcast 103.11.246.191
gateway 103.11.246.129
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 103.11.244.2
3. Change into below file
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
iface eth0 inet manual
# The primary network interface
auto br0
auto eth0
iface br0 inet static
address 103.11.246.187
netmask 255.255.255.192
network 103.11.246.128
broadcast 103.11.246.191
gateway 103.11.246.129
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 103.11.244.2
bridge_ports eth0
4. Save and quit.
___________________________________________________________________________
重启网卡配置生效,如果配置不生效就重启服务器配置生效:/etc/init.d/networking restart
ifconfig
fjxajey2a9@P10311246187188:/etc/network$ ifconfig
br0 Link encap:Ethernet HWaddr 6c:62:6d:7c:24:42
inet addr:103.11.246.187 Bcast:103.11.246.191 Mask:255.255.255.192
inet6 addr: fe80::6e62:6dff:fe7c:2442/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:105 errors:0 dropped:0 overruns:0 frame:0
TX packets:128 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:10544 (10.5 KB) TX bytes:22666 (22.6 KB)
eth0 Link encap:Ethernet HWaddr 6c:62:6d:7c:24:42
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:398034 errors:0 dropped:0 overruns:0 frame:0
TX packets:199878 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:461938965 (461.9 MB) TX bytes:16805360 (16.8 MB)
Interrupt:46 Base address:0xc000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:24 errors:0 dropped:0 overruns:0 frame:0
TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1824 (1.8 KB) TX bytes:1824 (1.8 KB)
virbr0 Link encap:Ethernet HWaddr 82:d7:f9:7f:7c:fb
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
使用命令virt-manager进入虚拟机配置的图形界面进行配置。
注意安装的时候硬盘要选择scsi格式的,不要用ide格式的,否则会很慢。架构也要使用qemu不要使用kvm。
When KVM installing windows, F8 key is not enable, so we need press ctrl + F8 instead.
阅读(2646) | 评论(0) | 转发(0) |