Openstack之用apt-get安裝KVM


首先必須在VMware Workstation中打開每一個虛擬機的虛擬化功能,通常來講支不支持虛擬化,取決於你的物理機的cpu是否支持,必須先在物理機的bios中打開Intel-VT或者AMD-V選項,若是不知道cpu是否支持虛擬化,能夠根據CPU型號本身查一下。
html

wKiom1mYlzrT1uA9AABip6R4d7o830.png


root@u-node3:/home/zxl# egrep -o "(vmx|svm)" /proc/cpuinfo node

vmxlinux

出現vmx則說明CPU爲Intel系列支持intel-VT,若是是svm,則說明爲AMD系列CPU,支持AMD-V虛擬化ios

ubuntu自帶的source.list可能會安裝失敗,這裏安裝下載source.list,用sohu源和Ali雲源ubuntu

root@u-node3:/home/zxl#vim /etc/apt/sources.listvim

deb http://mirrors.sohu.com/ubuntu/ precise main restricted
 deb-src http://mirrors.sohu.com/ubuntu/ precise main restricted
 deb http://mirrors.sohu.com/ubuntu/ precise-updates main restricted
 deb-src http://mirrors.sohu.com/ubuntu/ precise-updates main restricted
 deb http://mirrors.sohu.com/ubuntu/ precise universe
 deb-src http://mirrors.sohu.com/ubuntu/ precise universe
 deb http://mirrors.sohu.com/ubuntu/ precise-updates universe
 deb-src http://mirrors.sohu.com/ubuntu/ precise-updates universe
 deb http://mirrors.sohu.com/ubuntu/ precise multiverse
 deb-src http://mirrors.sohu.com/ubuntu/ precise multiverse
 deb http://mirrors.sohu.com/ubuntu/ precise-updates multiverse
 deb-src http://mirrors.sohu.com/ubuntu/ precise-updates multiverse
 deb http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse
 deb-src http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse
 deb http://mirrors.sohu.com/ubuntu/ precise-security main restricted
 deb-src http://mirrors.sohu.com/ubuntu/ precise-security main restricted
 deb http://mirrors.sohu.com/ubuntu/ precise-security universe
 deb-src http://mirrors.sohu.com/ubuntu/ precise-security universe
 deb http://mirrors.sohu.com/ubuntu/ precise-security multiverse
 deb-src http://mirrors.sohu.com/ubuntu/ precise-security multiverse
 deb http://extras.ubuntu.com/ubuntu precise main
 deb-src http://extras.ubuntu.com/ubuntu precise main網絡


deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
ide


root@u-node3:/home/zxl# apt-get update工具


能夠分別安裝以下的軟件
一、安裝kvm/qemu
sudo apt-get install kvm qemu
二、安裝libvirt
sudo apt-get install libvirt-bin libvirt-dev
三、網橋管理工具
sudo apt-get install bridge-utils
四、統一建模語言
sudo apt-get install uml-utilities
五、vnc 虛擬機查看工具
sudo apt-get install vncviewer vnc4serverui


qemu-kvm 和 qemu-system 是 KVM 和 QEMU 的核心包,提供 CPU、內存和 IO 虛擬化功能

libvirt-bin 就是 libvirt,用於管理 KVM 等 Hypervisor

virt-manager 是 KVM 圖形化管理工具

bridge-utils 和 vlan,主要是網絡虛擬化須要,KVM 網絡虛擬化的實現是基於 linux-bridge 和 VLAN


Ubuntu 默認不安裝圖形界面,能夠手工安裝一下
sudo apt-get install xinit
sudo apt-get install gdm
sudo apt-get install kubuntu-deskt



安裝KVM

root@u-node3:/home/zxl# apt-get install qemu-kvm ubuntu-vm-builder bridge-utils

啓用KVM內核模塊
root@u-node3:/home/zxl# modprobe kvm
root@u-node3:/home/zxl# modprobe kvm_intel
root@u-node3:/home/zxl# modprobe kvm_amd

驗證有沒有加載成功kvm模塊

root@u-node4:/home/zxl#  lsmod | grep kvm
kvm_intel             144426  0
kvm                   468280  1 kvm_intel


檢查kvm是否安裝成功,輸出以下則成功

root@u-node3:/home/zxl# kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

添加root用戶進入kvm組

root@u-node3:/home/zxl# adduser root kvm


安裝Libvirt

1:利用源碼編譯安裝,但首先要本身安裝各類依賴,很麻煩,不是很推薦,而後下載源碼(http://libvirt.org/sources/)解壓,用make:make install安裝

2:利用apt-get安裝,能夠安裝一系列的輔助工具,強烈建議這樣安裝


root@u-node3:/home/zxl# apt-get install libvirt-bin qemu virt-manager

安裝完成後經過以下步驟檢查是否成功

root@u-node4:/home/zxl# virsh list
 Id    Name                           State
----------------------------------------------------


root@u-node4:/home/zxl# ps -aux |grep "libvirtd"
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
root       3969  0.2  0.4 265044  9444 ?        Sl   09:30   0:00 /usr/sbin/libvirtd -d
root       4110  0.0  0.0   9392   932 pts/0    S+   09:31   0:00 grep --color=auto libvirtd

則表示安裝成功


管理界面

root@u-node3:/home/zxl# virt-manager

可能會報錯,No DBUS daemon Running,則採用下面的進程啓動dbus進程

root@u-node3:/home/zxl# eval `dbus-launch --auto-syntax`

root@u-node3:/home/zxl# virt-manager

wKioL1mV0YnwyEsYAABarQ_Ob0A788.png

wKioL1mYk3WTWMbVAAD7D8mZtqU813.png

則代表安裝成功(但用Xsell遠程鏈接好像不能打開,沒有反應)

相關文章
相關標籤/搜索