第一步:
更新系統(tǒng):yum -y update
第二步:
? 關(guān)閉防火墻:systemctl? stop firewalld
? 設(shè)置不開(kāi)機(jī)啟動(dòng)防火墻:?? systemctl disable firewalld
? 關(guān)閉selinux:? vi /etc/selinux/config?????????? SELINUX=disabled
? 重啟系統(tǒng):? reboot
第三步:安裝KVM
a.查看主機(jī)是否支持虛擬化
??Intel CPU:cat /proc/cpuinfo |grep --color vmx
???AMD CPU:cat/proc/cpuinfo |grep --color smv
b.安裝KVM
?? ####****?? yum -y install epel-release -y???? (如果是通過(guò)Inter網(wǎng)絡(luò)部署才安裝)
? yum-y install kvm libvirt libvirt-python python-virtinst qemu-kvm-tools qemu-img?? (參考不用安裝)
??****?? yum -y install qemu-kvmlibvirt libguestfs-tools virt-install virt-manager libvirt-python????
c.啟動(dòng)KVM服務(wù)
?systemctl start libvirtd
?systemctl enable? libvirtd
?systemctl status?? libvirtd??????? 或者??? systemctl??is-enabled? libvirtd
d.使用virt-manager 調(diào)出圖形管理界面
[if !vml]
[endif]
注意:在生產(chǎn)環(huán)境中如果提示沒(méi)有X11就是缺少遠(yuǎn)程桌面依賴,那么就需要安裝相關(guān)的插件
yum -y install libX11xorg-x11-server-utils xorg-x11-proto-devel dbus-x11 xorg-x11-xauthxorg-x11-drv-ati-firmware xorg-x11-xinit
?
第四步配置網(wǎng)橋
cp /etc/sysconfig/network-scripts/ifcfg-ens33/etc/sysconfig/network-scripts/ifcfg-br0????????
A.編輯ens33網(wǎng)卡信息
vi/etc/sysconfig/network-scripts/ifcfg-ens33
[if !vml][endif][if !vml]
[endif]???
B.編輯br0網(wǎng)卡信息
vi
/etc/sysconfig/network-scripts/ifcfg-br0
[if !vml]
[endif]
C.重啟網(wǎng)絡(luò):?
service network restart?? 之后ip? a查看 br0 網(wǎng)卡的IP地址是否生效? 。沒(méi)有就直接:reboot? 再查看ip a? 中的br0是否有IP地址
[if !vml]
[endif]
d.測(cè)試網(wǎng)絡(luò)是否正常
第五步KVM安裝虛擬機(jī)之前的部署
[if !supportLists]a.?????[endif]遞歸創(chuàng)建存儲(chǔ)池
mkdir -pv /kvm/{store,iso}
[if !vml]
[endif]
b.運(yùn)行虛擬機(jī)管理軟件部署ISO,和存儲(chǔ)的路徑
[if !vml]
[endif]
c. 雙擊QEMU/KVM選擇"存儲(chǔ)選項(xiàng)卡",然后單擊"+"按鈕新建存儲(chǔ)池
[if !vml]
[endif]
d.根據(jù)提示輸入存儲(chǔ)池的名稱夸政,如store;
[if !vml]
[endif]
e.點(diǎn)擊(前進(jìn))Forward,指定store存儲(chǔ)池里面內(nèi)容的store存儲(chǔ)目錄(該處為之前新建的/kvm/store)更胖;
[if !vml]
[endif]
[if !vml]
[endif]
f. 同樣的操作創(chuàng)建iso的鏡像存儲(chǔ)池,單擊"+"按鈕新建存儲(chǔ)池隔显;完成后如下圖却妨。
[if !vml]
[endif]
g.上傳鏡像到ISO目錄中,也稱為鏡像池
[root@localhost ~]# cd /kvm/iso/
[root@localhost iso]# rz
[if !vml]
[endif]
h. 查看上傳的ISO鏡像
[if !vml]
[endif]
第六步KVM安裝虛擬機(jī)
新建存儲(chǔ)卷:存儲(chǔ)卷即安裝系統(tǒng)時(shí)虛擬機(jī)所使用的磁盤(pán)文件括眠,在vmware軟件中新建虛擬機(jī)時(shí)可選擇磁盤(pán)文件的位置和大小彪标,而KVM可提前新建虛擬機(jī)所使用磁盤(pán)文件及大小(當(dāng)然也可直接使用默認(rèn)KVM創(chuàng)建的default存儲(chǔ)池空間)掷豺,相比更加靈活
[if !supportLists]a.?????[endif]單擊剛創(chuàng)建好的"store"存儲(chǔ)池捞烟,單擊對(duì)話框中間的"+"按鈕建立一個(gè)存儲(chǔ)卷;
[if !vml]
[endif]
[if !vml]
[endif]
[if !supportLists]b.?????[endif]回到首頁(yè)虛擬系統(tǒng)管理器后当船,選擇"第一個(gè)電腦圖標(biāo)"選項(xiàng)题画;
[if !vml]
[endif]
[if !supportLists]c.?????[endif]選擇上傳的鏡像
[if !vml]
[endif]
[if !supportLists]d.?????[endif]更改虛擬機(jī)的cpu、內(nèi)存配置:
[if !supportLists]e.?????[endif]選擇之前創(chuàng)建好的卷
[if !vml]
[endif][if !vml]
[endif]
[if !supportLists]f.??????[endif]指定虛擬機(jī)名稱德频,然后將Storage選項(xiàng)下方的方格勾選上苍息;
[if !vml]
[endif]
[if !supportLists]g.?????[endif]點(diǎn)擊“開(kāi)始安裝(Begin Installation)”
[if !supportLists]h.???? [endif]解決virt-manager (KVM)安裝虛擬機(jī)無(wú)法使用鍵盤(pán)
[if !vml]
[endif]