﻿{"id":105,"date":"2018-01-11T14:25:05","date_gmt":"2018-01-11T06:25:05","guid":{"rendered":"http:\/\/simon.ice.com.tw\/?p=105"},"modified":"2020-05-17T19:22:35","modified_gmt":"2020-05-17T11:22:35","slug":"kvm-%e6%a9%8b%e6%8e%a5","status":"publish","type":"post","link":"https:\/\/old.ice.com.tw\/?p=105","title":{"rendered":"kvm \u6a4b\u63a5"},"content":{"rendered":"<p><strong>\u95dc\u9589 SELINUX<br \/>\n<\/strong>#vim \/etc\/selinux\/config<\/p>\n<p><strong>\u5b89\u88ddKVM<br \/>\n<\/strong>===========================================================================<br \/>\nCentOS7<br \/>\n#yum install qemu-kvm libvirt virt-install bridge-utils<br \/>\nUbuntu<br \/>\n#apt-get install kvm qemu libvirt-bin virtinst ubuntu-vm-builder bridge-utils virt-manager virt-viewer<\/p>\n<p>#\u67e5\u770b\u662f\u5426\u52a0\u8f7dkvm\u6a21\u5757<br \/>\n[root@kvm ~]# lsmod|grep kvm<br \/>\nkvm_intel\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 138567\u00a0 0<br \/>\nkvm\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 441119\u00a0 1 kvm_intel<\/p>\n<p>#\u5982\u679c\u6ca1\u6709\u8fd9\u4e24\u6761\uff0c\u53ef\u4ee5\u7528\"modprobe kvm\"\u52a0\u8f7d\uff1b<br \/>\n#\u76f8\u5173\u547d\u4ee4\"insmod;rmmod;modinfo\"<\/p>\n<p>#\u542f\u52a8libvirtd<br \/>\n[root@localhost ~]# systemctl start libvirtd;systemctl enable libvirtd<br \/>\n[root@localhost ~]# systemctl list-unit-files|grep libvirtd<br \/>\nlibvirtd.service\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 enabled<\/p>\n<p><strong>\u6a4b\u63a5\u7db2\u5361<br \/>\n<\/strong>==========================================================<br \/>\n<strong># systemctl stop NetworkManager<br \/>\n<\/strong><strong># systemctl disable NetworkManager<br \/>\n# systemctl enable network<br \/>\n#systemctl stop firewalld<br \/>\n#systemctl disable firewalld<br \/>\n<\/strong><\/p>\n<div>\u00a0#vim ifcfg-enp0s3<br \/>\n\u589e\u52a0\u9019\u4e00\u884c BRIDGE=br0<\/div>\n<p>#vim ifcfg-br0<br \/>\nDEVICE=br0<br \/>\nTYPE=Bridge<br \/>\nBOOTPROTO=static<br \/>\nIPADDR=192.168.1.63<br \/>\nNETMASK=255.255.255.0<br \/>\nGATEWAY=192.168.1.254<br \/>\nDNS1=168.95.1.1<br \/>\nONBOOT=yes<\/p>\n<p>#service network restart<br \/>\n#brctl show<\/p>\n<p>\u5ba2\u6236\u7aefCentOS7 \u5b89\u88dd\u684c\u9762<br \/>\n#<code>virt-manager --no-fork<\/code><br \/>\n# yum groupinstall \"GNOME Desktop\" \"Graphical Administration Tools\"<br \/>\n# systemctl set-default graphical.target<br \/>\n# reboot<\/p>\n<p><strong>KVM Nested<br \/>\n<\/strong>==========================================================<br \/>\n#cat \/sys\/module\/kvm_intel\/parameters\/nested<br \/>\n\u5982\u679c\u6709\u652f\u63f4\u6703\u50b3\u56de y<br \/>\n\u5426\u5247\u57f7\u884c\u4e0b\u5217<br \/>\nIntel CPU<br \/>\n#echo \"options kvm-intel nested=Y\" &gt; \/etc\/modprobe.d\/kvm-intel.conf<br \/>\nAMD CPU<br \/>\n#echo \"options kvm-amd nested=1\" &gt; \/etc\/modprobe.d\/kvm-amd.conf<\/p>\n<p>==========================================================<br \/>\n\u5b89\u88c5ssh-askpass-gnome\u6765\u5141\u8bb8\u5f39\u51fa\u8ba4\u8bc1\u6846\uff1a<br \/>\n#apt-get\u00a0install ssh-askpass-gnome<br \/>\n#yum install openssh-askpass<br \/>\n==========================================================<br \/>\n\u67e5\u770b\u5df2\u5b89\u88c5\u7684kvm\u7248\u672c<br \/>\n<span style=\"display: inline !important; float: none; background-color: transparent; color: #333333; font-family: 'Segoe UI','Lucida Grande',Helvetica,Arial,'Microsoft YaHei',FreeSans,Arimo,'Droid Sans','wenquanyi micro hei','Hiragino Sans GB','Hiragino Sans GB W3',FontAwesome,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;\"># qemu-img --help | grep version<br \/>\n<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u95dc\u9589 SELINUX #vim \/etc\/selinux\/config \u5b89\u88ddKVM ============= &hellip; <a href=\"https:\/\/old.ice.com.tw\/?p=105\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008kvm \u6a4b\u63a5\u3009<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-105","post","type-post","status-publish","format-standard","hentry","category-kvm"],"_links":{"self":[{"href":"https:\/\/old.ice.com.tw\/index.php?rest_route=\/wp\/v2\/posts\/105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/old.ice.com.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/old.ice.com.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/old.ice.com.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/old.ice.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=105"}],"version-history":[{"count":22,"href":"https:\/\/old.ice.com.tw\/index.php?rest_route=\/wp\/v2\/posts\/105\/revisions"}],"predecessor-version":[{"id":249,"href":"https:\/\/old.ice.com.tw\/index.php?rest_route=\/wp\/v2\/posts\/105\/revisions\/249"}],"wp:attachment":[{"href":"https:\/\/old.ice.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/old.ice.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/old.ice.com.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}