====== CentOS6 KVM 使用 console 模式建立 VM ====== 之前都透過 X Win 下的 virt-manager 來建立 VM , 當無法啟用 X Win 的環境下, 就需要透過文字命令模式建立 VM * 環境 Host : CentOS 6.8 x86_64 * 預計建立 Guest : CentOS 7 x86_64 ===== 建立 VM 程序 ===== * 預計建立 ever-test-3 , 1 vCPU/1G RAM/20G HD , CDROM:/home/ISO/CentOS-7-x86_64-Minimal-1511.iso , 有兩個網卡分別接上 host 的 br0 與 br1 * 先建立 20G Disk Image file 在 /kvm/image/ever-test-3.qcow2 qemu-img create -f qcow2 -o preallocation=off /kvm/image/ever-test-3.qcow2 20G [root@HP-ML10G9 ~]# qemu-img create -f qcow2 -o preallocation=off /kvm/image/ever-test-3.qcow2 20G Formatting '/kvm/image/ever-test-3.qcow2', fmt=qcow2 size=21474836480 encryption=off cluster_size=65536 preallocation='off' [root@HP-ML10G9 ~]# ls -lt /kvm/image/ever-test-3.qcow2 -rw-r--r-- 1 root root 197120 2016-11-08 09:18 /kvm/image/ever-test-3.qcow2 * 建立 VM 與光碟安裝 CentOS 7 virt-install --name ever-test-3 --vcpu 1 --ram 1024 --os-type linux --disk /kvm/image/ever-test-3.qcow2,device=disk,bus=virtio,format=qcow2,size=20 --network bridge:br0 --network bridge:br1 --cdrom /home/ISO/CentOS-7-x86_64-Minimal-1511.iso {{:tech:kvm-install-01.png}} * 按下 [tab] 增加 linux kernel 開機參數 console=ttyS0,115200 \\ {{:tech:kvm-install-02.png}} * 進入 CentOS7 光碟安裝程序 \\ {{:tech:kvm-install-03.png?750}} ++++ 其他安裝畫面 | {{:tech:kvm-install-04.png}} {{:tech:kvm-install-05.png}} {{:tech:kvm-install-06.png}} {{:tech:kvm-install-07.png}} {{:tech:kvm-install-08.png}} {{:tech:kvm-install-09.png}} {{:tech:kvm-install-10.png}} {{:tech:kvm-install-11.png}} {{:tech:kvm-install-12.png}} {{:tech:kvm-install-13.png}} {{:tech:kvm-install-14.png}} {{:tech:kvm-install-15.png}} {{:tech:kvm-install-16.png}} {{:tech:kvm-install-17.png}} {{:tech:kvm-install-18.png}} {{:tech:kvm-install-19.png}} {{:tech:kvm-install-20.png}} ++++ * 過程中如果要離開 console 模式可以在鍵盤上按下 CTRL + ] 或是 CTRL + 5 ===== 參考網址 ===== * https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Deployment_and_Administration_Guide/sect-Troubleshooting-Common_libvirt_errors_and_troubleshooting.html * https://superuser.com/questions/637669/how-to-exit-a-virsh-console-connection ===== 相關網址 ===== {{topic>linux-kvm}} {{tag>linux-kvm console linux}}