yum install virt-manager.x86_64
yum install virt-viewer.x86_64
yum install libvirt-devel.x86_64
yum install libvirt-python.x86_64
yum install libvirt.x86_64
/etc/libvirt/qemu.conf
vnc_listen ="0.0.0.0"
重启libvirtd服务:
sudo service libvirtd restart
qemu-img create-f qcow2 centos7.img 64G
不要事先创建qcow2格式的磁盘文件,该文件创建之后的初始大小只有256kB。CentOS系统安装时会因为磁盘空间不足而退出。
General Options
General configuration parameters that apply to alltypes of guest installs.
-n NAME , --name=NAME(指定虚拟机名字)
Name of the new guest virtual machine instance.This must be unique amongst all guests known to the hypervisor on theconnection, including those not currently active.Tore-define an existing guest, use the virsh(1) toolto shut it down ('virsh shutdown') & delete ('virsh undefine') it prior torunning "virt-install".
-r MEMORY , --ram=MEMORY(指定内存大小)
Memory to allocate for guest instance in megabytes.If the hypervisor does not have enough free memory, it is usual for it toautomatically take memory away from the host operating system to satisfy thisallocation.
InstallationMethod options
-c CDROM , --cdrom=CDROM
File or device use as a virtual CD-ROM device forfully virtualized guests. It can be path to an ISO image, or toa CDROMdevice. It can also be a URL from which to fetch/access aminimal boot ISO image. The URLs take the same format as describedfor the "--location" argument. If a cdrom has beenspecified via the "--disk" option, andneither "--cdrom" nor any other install option isspecified, the "--disk" cdrom is used as the install media.
sudo virt-install \
-n centos7vm \
-r 4096 \
--vcpus=4 \
--hvm \
--accelerate \
--os-type=linux\
--disk path=/home/elvis/virtualmachine/centos7.img,size=80,bus=virtio,cache=none\
--vnc \
--networkbridge=virbr0 \
-c /home/elvis/virtualmachine/CentOS-7-x86_64-DVD-1511.iso
在Mac或Windows本机上采用vnc客户端连接开发机KFC中正在启动的虚拟机,通过vnc界面操作安装CentOS
VNC是个不错的工具,采用VNC Viewer来连接一台服务器时,输入密码连上后直接闪退,可能是ColourLevel的问题。
Solution: 设置Option-->Advanced-->Expert找到ColourLevel,默认值是pal8,修改为rgb222或full。
从CDROM装完CentOS后,重新开机启动后显示:
Initial setup of CentOS Linux 7 (core)
1) [x] Creat user 2) [!] License information
(no user will be created) (license not accepted)
Please make your choice from above [‘q’ to quit |‘c’ to continue | ‘r’ to refresh]:
解决方法:
输入“1”,按Enter键
输入“2”,按Enter键
输入“q",按Enter键
输入“yes”,按Enter键
命令: sudo virsh stop centos7vm
命令: sudo virsh start centos7vm
开始之后就可以通过VNCViewer链接该虚拟机了。