标签:oca 设置 state create prot irb kvm安装 data alt
安装环境:CPU:2C
内存:4G
Hostname:kvm.com
IP:172.24.77.241
grep -E "vmx|svm" /proc/cpuinfo | wc -l
[root@kvm ~]# grep -E "vmx|svm" /proc/cpuinfo | wc -l
2
yum install qemu-kvm qemu-kvm-tools libvirt virt-manager virt-install -y
systemctl start libvirtd
systemctl enable libvirtd
ifconfig virbr0
grep "192.168.122.1" /etc/libvirt/ -R
/etc/libvirt/qemu/networks/autostart/default.xml: <ip address=‘192.168.122.1‘ netmask=‘255.255.255.0‘>
/etc/libvirt/qemu/networks/default.xml: <ip address=‘192.168.122.1‘ netmask=‘255.255.255.0‘>
默认保存虚拟机磁盘的路径
ll /var/lib/libvirt/images/
qemu-img create -f raw /var/lib/libvirt/images/CentOS-7-x86_64.raw 10G
qemu-img create -f qcow2 /var/lib/libvirt/images/centos.qcow2 10G
ll /var/lib/libvirt/images/
total 196
-rw-r--r-- 1 root root 197120 Jul 10 00:02 centos.qcow2
ll /usr/local/src/
total 8086528
-rw-r--r-- 1 root root 8280604672 Jul 10 00:14 CentOS-7-x86_64-Everything-1611.iso
virt-install --virt-type kvm --name centos7 --ram 1024 --vcpus 2 --cdrom=/usr/local/src/CentOS-7-x86_64-Everything-1611.iso --disk path=/var/lib/libvirt/images/centos.qcow2 --network network=default --graphics vnc,listen=0.0.0.0 --noautoconsole
ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 1 :5900 :
LISTEN 0 5 192.168.122.1:53 :
LISTEN 0 128 :22 :
LISTEN 0 100 127.0.0.1:25 :
LISTEN 0 128 :::22 :::
LISTEN 0 100 ::1:25 :::
virsh list --all
2 centos7 shut off
virsh start centos7
通过virt-manager管理虚拟机
virt-manager
上传win10iso镜像
ll /usr/local/src/
total 12288972
-rw-r--r-- 1 qemu qemu 8280604672 Jul 10 00:14 CentOS-7-x86_64-Everything-1611.iso
-rw-r--r-- 1 root root 4303300608 Jul 10 00:32 win10pro.iso
qemu-img create -f qcow2 /var/lib/libvirt/images/Windows10.qcow2 40G
ll /var/lib/libvirt/images/
total 1860424
-rw-r--r-- 1 qemu qemu 1249837056 Jul 10 00:33 centos.qcow2
-rw-r--r-- 1 root root 197632 Jul 10 00:33 Windows10.qcow2
virt-install --virt-type kvm --name Win10 --ram 3072 --vcpus=2 --os-type=windows --cdrom=/usr/local/src/win10pro.iso --disk path=/var/lib/libvirt/images/Windows10.qcow2,format=qcow2,bus=virtio --disk path=/usr/local/src/virtio-win-0.1.141_amd64.vfd,device=floppy --network bridge=br0,model=virtio --graphics vnc,listen=0.0.0.0 --noautoconsole
virt-install --name=systemname --vcpu=2 --ram=3072 --disk path=path_of_img_or_qcow2,format=qcow2 --boot=hd --network bridge=br0,model=virtio --vnc --vncport=123456 --vnclisten=0.0.0.0 --noautoconsole
yum install bridge-utils
cd /etc/sysconfig/network-scripts/
vim ifcfg-br0
TYPE=Bridge
BOOTPROTO=static
NAME=br0
DEVICE=br0
ONBOOT=yes
IPADDR=172.24.77.248
NETMASK=255.255.255.128
GATEWAY=172.24.77.129
DNS1=114.114.114.114
cp ifcfg-ens33 ifcfg-ens33.bak
vim ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=static
NAME=ens33
DEVICE=ens33
ONBOOT=yes
BRIDGE=br0
systemctl restart network
qemu-img create -f qcow2 /var/lib/libvirt/images/centos7-bridge.qcow2 10G
ll /var/lib/libvirt/images/
total 1345612
-rw-r--r-- 1 root root 197120 Jul 10 01:17 centos7-bridge.qcow2
virt-install --virt-type kvm --name centos7-bridge --ram 1024 --vcpus 2 --cdrom=/usr/local/src/CentOS-7-x86_64-Everything-1611.iso --disk path=/var/lib/libvirt/images/centos7-bridge.qcow2 --network network=br0 --graphics vnc,listen=0.0.0.0 --noautoconsole
标签:oca 设置 state create prot irb kvm安装 data alt
原文地址:https://blog.51cto.com/13688209/2510666