设为首页 收藏本站
查看: 906|回复: 0

[经验分享] redhat install kvm

[复制链接]

尚未签到

发表于 2018-5-10 11:58:57 | 显示全部楼层 |阅读模式
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 kvmfilename:       /lib/modules/2.6.32-220.el6.x86_64/kernel/arch/x86/kvm/kvm.kolicense:        GPLauthor:         Qumranetsrcversion:     E0EC656A576974AAE72808Ddepends:vermagic:       2.6.32-220.el6.x86_64 SMP mod_unload modversionsparm:           oos_shadow:boolparm:           ignore_msrs:boolparm:           allow_unsafe_assigned_interrupts:Enable device assignment on platforms without interrupt remapping support. (bool)------------# modinfo kvm_intelfilename:       /lib/modules/2.6.32-220.el6.x86_64/kernel/arch/x86/kvm/kvm-intel.kolicense:        GPLauthor:         Qumranetsrcversion:     0B88774FBBF6ECB64244D3Adepends:        kvmvermagic:       2.6.32-220.el6.x86_64 SMP mod_unload modversionsparm:           bypass_guest_pf:boolparm:           vpid:boolparm:           flexpriority:boolparm:           ept:boolparm:           unrestricted_guest:boolparm:           emulate_invalid_guest_state:boolparm:           yield_on_hlt:boolparm:           ple_gap:intparm:           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 .

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-458108-1-1.html 上篇帖子: RedHat命令行和图形界面切换 下篇帖子: Redhat实用命令~不断学习中
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表