redhat6 install kvm

1. Install the following packages for setting up  guest hosts using KVM virtualization .

                    # yum install  virt-install  virsh  libvirt  kvm
  

                     # yum install kvm python-virtinst libvirt libvirt-python virt-manager
  
                     # yum install virt-viewer libguestfs-tools

2.   Check whether the following modules are loaded . If not , load it manually using insmod. 

# modinfo kvm
filename:       /lib/modules/2.6.32-220.el6.x86_64/kernel/arch/x86/kvm/kvm.ko
license:        GPL
author:         Qumranet
srcversion:     E0EC656A576974AAE72808D
depends:
vermagic:       2.6.32-220.el6.x86_64 SMP mod_unload modversions
parm:           oos_shadow:bool
parm:           ignore_msrs:bool
parm:           allow_unsafe_assigned_interrupts:Enable device assignment on platforms without interrupt remapping support. (bool)

------------

# modinfo kvm_intel
filename:       /lib/modules/2.6.32-220.el6.x86_64/kernel/arch/x86/kvm/kvm-intel.ko
license:        GPL
author:         Qumranet
srcversion:     0B88774FBBF6ECB64244D3A
depends:        kvm
vermagic:       2.6.32-220.el6.x86_64 SMP mod_unload modversions
parm:           bypass_guest_pf:bool
parm:           vpid:bool
parm:           flexpriority:bool
parm:           ept:bool
parm:           unrestricted_guest:bool
parm:           emulate_invalid_guest_state:bool
parm:           yield_on_hlt:bool
parm:           ple_gap:int
parm:           ple_window:int  

3.  Restart libvirtd service

# /etc/init.d/libvirtd restart
               Stopping libvirtd daemon:                                  [FAILED]
               Starting libvirtd daemon:

Setting Up Networking

1.   Create a new br0 network device of TYPE Bridge using system-config-network command or  

      create it manually as shown below. Assign IP Address and other network configuration details 

      based on your requirement. 

.

# vim /etc/sysconfig/network-scripts/ifcfg-br0
           DEVICE="br0"
           NM_CONTROLLED="no"
          ONBOOT=yes
          TYPE=Bridge
          BOOTPROTO=none
          IPADDR=192.168.2.148
          PREFIX=26
          GATEWAY=192.168.2.130
          NAME="System br0"

2.   Modify the original network configuration file (e.g /etc/sysconfig/network-scripts/ifcfg-eth0 )     

     and comment out BOOTPROTO , IPADDR  , PREFIX and GATEWAY parameters . Add 

      the following network parameter and restart network service .                                       

                                                          BRIDGE=br0 

     So , the final eth0 network interface file will be as follows

$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
          DEVICE=eth0

NM_CONTROLLED=no
          BRIDGE=br0
          ONBOOT=yes
          TYPE=Ethernet
          #BOOTPROTO=static
          #IPADDR=192.168.2.148
          #NETMASK=255.255.255.192
            USERCTL=no
          #GATEWAY=192.168.2.130

3. Restart network service

#/etc/init.d/network restart

If all went fine your network configuration will be as follows:

# ifconfig

eth0     Link encap:Ethernet  HWaddr 44:1E:A1:55:B0:B0

UP BROADCAST RUNNING  MULTICAST  MTU:1500  Metric:1

RX packets:724970 errors:0 dropped:0 overruns:0 frame:0

TX packets:8032 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:239225199 (228.1 MiB)  TX bytes:1348488 (1.2 MiB)

br0       Link encap:Ethernet  HWaddr 44:1E:A1:55:B0:B0

inet addr:192.168.2.147  Bcast:192.168.2.191  Mask:255.255.255.192

inet6 addr: fe80::461e:a1ff:fe55:b0b0/64 Scope:Link

UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

RX packets:22 errors:0 dropped:0 overruns:0 frame:0

TX packets:30 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:3898 (3.8 KiB)  TX bytes:3196 (3.1 KiB)

lo        Link encap:Local Loopback

inet addr:127.0.0.1  Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING  MTU:16436  Metric:1

RX packets:2794116 errors:0 dropped:0 overruns:0 frame:0

TX packets:2794116 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:260264756 (248.2 MiB)  TX bytes:260264756 (248.2 MiB)

Creating the Guest Hosts

There are two tools available for creating  guest hosts . One is virt-manager tool which has a graphical interface and the other is virt-install tool which has a text interface . We will be using virt-install tool to setup guest hosts.

For our case , we will be creating a virtual hosts with 3 GB of RAM , 3 no of CPUs  and with a hard disk space of 20G . The command will be as follows:

# virt-install --network bridge=br0 \

--name  vm-dbase   \

--ram=3072  \

--vcpus=3  \

--disk path=/var/lib/libvirt/images/vm1-mysql.img,size=20  \

--graphics none   \

--location=http://192.168.4.139/rhelisos  \

--extra-args="console=tty0 console=ttyS0,115200"  \

--os-type=linux  \

--os-variant=rhel6

Little description is as follows:

       --vcpus= Number of virtual cpus to configure for the guest. 

       --location=An HTTP server location containing an installable distribution image

--disk=Specifies media to use as storage for the guest, with various options including size of disk 

       --name=Name of the new guest virtual machine instance.     

Press Enter and here you go , creation of virtual host will get initiated  . Follow the on-screen instructions for setting up the OS . These are the standard instructions we need to pass through while installing Linux . Once you are done providing all the parameters , a minimal OS installation will be done. The Guest host will be rebooted after installation is complete and you will be provided with a login prompt to login into the guest operating system .


时间: 2024-08-14 07:30:29

redhat6 install kvm的相关文章

c++  与  java  中的 继承

C++ 代码: #include <iostream> #include <string> using namespace std; class Parent { public: void fun() {cout<<"Parent fun"<<endl;} void fun(int a) {cout<<"Parent fun int a"<<endl;} void fun(int a, int

python 学习第八课 -- 异常 反射 socket

面向对象 相关 一.isinstance(obj,cls)  查看obj是否为cls的对象 issubclass(sub,super) 查看类sub是否为super的派生类 二. 异常处理 1.   异常基础 try: pass except Exception,e: print e e为Exception的对象,print e 就是print Exception中的__str__ 2.   异常种类 常用异常 AttributeError 试图访问一个对象没有的树形,比如foo.x,但是foo

自写函数VB6 STUFF函数 和 VB.net 2010 STUFF函数 详解

'*************************************************************************'**模 块 名:自写函数VB6 STUFF函数 和 VB.net 2010 STUFF函数 详解'**说    明:蓝凤凰设计商城 浴火凤凰-郭卫 | 蓝凤凰-魔灵 | 郭卫-icecept'**创 建 人:浴火凤凰-郭卫'**日    期:2015年10月10日  23:13:55'**修 改 人:浴火凤凰-郭卫'**日    期:'**描   

lind 语 api 数据的安全性  第四弹

web api的安全性怎么保证呢. 一般公司会自己封装一套请求的规范. 下面来看看lind语里的webapi安全规范 step one 先看下 diagram: 学而思: 从上面的图分析一下: 如果我们的webapi开放给第三方的平台那么:这里的规范是否适用呢. 思考一下. 成为习惯 step tow .... 我们来看下代码: 注意 我们是因为里面又两个:一个 是 看 的我 .一个是 学的我.一个是思的我. 所以 这里是有三个我 看我曰:我去翻码.

TCP 和 UDP 编程 —— Android

参考了<深入理解Android网络编程>这本书 我们都知道TCP和UDP最大的区别就是,TCP是面向连接的,而UDP是无连接的. 那么使用TCP和UDP编程,事实上差别也是在这里: 1.使用TCP通讯: 分为客户端和服务器,主要是先初始化,像IP,端口这些肯定要先绑定的,服务器等待客户端连接,连接之后,通过流进行数据的收发. A.首先是服务器端: 步骤1:初始化——ServerSocket serverCocket = null://创建一个ServerSocket对象 serverCocke

Linux 内存 virt res shr data swap 意义

virt  res shr data 这几个很容易搞混了,写一下 首先解释下含义: virt : 程序占用的虚拟内存 man: The total amount of virtual memory used by the task. It includes all code, data and shared libraries plus pages that have been swapped out and pages that have been mapped but not used. r

HDU 1025 Constructing Roads In JGShining&#39;s Kingdom   LIS 简单题 好题 超级坑

Constructing Roads In JGShining's Kingdom Problem Description JGShining's kingdom consists of 2n(n is no more than 500,000) small cities which are located in two parallel lines. Half of these cities are rich in resource (we call them rich cities) whi

Centos6.5 配置  DRBD8.4.3

废话不多说,现在开始: 1.2台虚拟机,Centos6.5系统,系统配置啥的都一样,能互相ping 通.把它们称为A和B. 2. A: server iptables stop setenforce 1                 //先把这2台服务器的防火墙和SELINUX关闭. ------------------------------------------- B: server iptables stop setenforce 1                 //先把这2台服务

《程序员的职业修养》读后感(二):说"不" and 说“是”

简介:"能就是能,不能就是不能,不要说'试试看'."另一方面,作为一个初入行业的程序员,我们有没有权利,应不应该说不(或是)呢,又该何时何地何事说"不(或是)"?这篇文章就解决此问题. 相信工作的人对此都会很有感触,当老板交给我们一个任务时,不管是对自己能力的不清楚认识,还是迫于老板的"淫威",大家貌似好像都不敢说一句能或者不能,总是选择一个折中的答案:我去试试看.可是这样的话语给老板的潜意识意思就是你可以完成,但是在你这里,这句话的潜意思就是我也很可能完不成.所以