CentOS kvm deploy

package install

# basic install the package
yum install -y libvirt qemu-kvm

netcard configure

# make a bridge point
brctl addbr br0
# configure the bridge point created above
/etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
ONBOOT=yes
BOOTPROTO=Static
IPADDR=10.0.92.206
NETMASK=255.255.0.0
DELAY=0
# modify the basic physical netcard to bridge mode
/etc/sysconfig/network-scripts/ifcfg-em2
DEVICE=em2
ONBOOT=yes
BRIDGE=br0
# configure the bridge route option
/etc/sysconfig/network-scripts/route-br0
3.3.3.0/24 via 10.0.0.1
# restart netcard to make the config alive
/etc/init.d/network restart

make a vm

# make a qcow file for the kvm machine
qemu-img create -f qcow2 some.qcow2 1300G
# use the command line to install os with a vnc port
virt-install --name=somename --ram=4096 --vcpus=4  --accelerate --cdrom=someiso.iso --disk path=somedisk.qcow2,format=qcow2,size=2000,bus=virtio --bridge=br0,model=virtio --autostart --vnc --vncport=5911 --vnclisten=0.0.0.0

some libvirt command

# list all machines
virsh list --all

# configure for auto start
virsh autostart somemachine

# 关闭一个虚机
virsh shutdown somemachine

# 强制关闭一个虚机
virsh destroy somemachine

# 删除一个虚机
virsh undefine somemachine

# 修改参数,重新定义一个虚机
virsh define somemachine

kvm configure modify

# modify /etc/libvirt/qemu/somemachine.xml
<graphics type='vnc' port='5930' autoport='no' listen='0.0.0.0' passwd='somepassword'>

clone a kvm machine

1. 删除uuid
2. 删除mac
3. 修改name
4. 修改内存
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值