KVM搭建和其中虚拟机创建

本文是参考了其他的文章

以下操作在root权限下操作

1 检测自己的电脑是否支持虚拟化

在终端执行#cat /proc/cpuinfo(或#grep -E '(vmx|svm)' /proc/cpuinfo)命令,找到flags部分,如果其中输出有VMX或SVM,即表明支持虚拟化技术。

如果不支持,查看下BIOS中的虚拟化设置是否为enable状态,可以的话开启。

2 内核版本是否支持,2.6以上都可以支持

查看版本方法:uname -r

3 安装kvm软件

apt-get install kvm*(这个方法比较简便)或者也可以apt-get install kvmubuntu-virt-server kvm-pxe

apt-get install virt-manager

apt-get install python-vm-builder

4 加载kvm相关模块到内核

modprobe kvm

modprobe kvm-intel

5 验证kvm模块

lsmod | grep kvm

显示:

kvm_intel 132891 0

kvm   4431651kvm_intel

6 验证 libvirt服务状态

service libvirt-bin status

7网络配置

网络配置的两种模式:NAT、桥接

bridge:

method 1:

auto eth0

iface eth0 inet static        

address 172.18.48.103

netmask 255.255.255.0

gateway ...

dns-nameservers ...  

auto virbr0

iface virbr0 inet dhcp

bridge_ports eth0 


method 2:

auto eth0

iface eth0 inet manual

auto virbr0

iface virbr0 inet static        

address 172.18.48.103

netmask 255.255.255.0

gateway .........

dns-nameservers ...        

bridge_ports eth0        

bridge_fd 9

bridge_hello 2        

bridge_maxage 12        

bridge_stp off


8 安装虚拟机流程

开启virt-manager

终端输入:virt-manager 会弹出管理界面,选择创建虚拟机选型,记性配置,在配置完成这一页,选择“安装前配置虚拟机中”,有一项是关于远程连接的方式采用Spice和VNC,如果需要采用spice可以进行选择。选择应用是时需要安装spice 通道的选项,选择是,就OK了,开始了kvm虚拟安装。


Tips:(I write some information on linux without input method)

1 you have installed the  libvirt-bin,but you can not find the device  when you user ifconfig or ifconfig virbr0

>you can check in the bridge is exist or not ,if the bridge isn't exist, you can add  a virtual bridge use the order like this: brctl addif devicename.First ,using the order you must install the tool,install like this:

apt-get install bridge-utils

>you device is exist,you can call up the device like this:

/sbin/ifup devicename


2 if you use ububtu to  do the experiment.when you can not get in to the login desktop ,you could use to press the keys: ctrl+alt+(F1/F2/F3/F4/F5/F6) to the order line status.

see where is the issue,you can find the question one by one.










  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值