{"id":42944,"date":"2024-10-04T10:22:08","date_gmt":"2024-10-04T02:22:08","guid":{"rendered":"https:\/\/server.hk\/cnblog\/42944\/"},"modified":"2024-10-04T10:22:08","modified_gmt":"2024-10-04T02:22:08","slug":"centos-7-2-%e4%b8%8b-kvm-%e8%99%9b%e6%93%ac%e5%8c%96%e7%ae%a1%e7%90%86%e5%b9%b3%e5%8f%b0-webvirtmgr-%e9%83%a8%e7%bd%b2","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/42944\/","title":{"rendered":"CentOS 7.2 \u4e0b KVM \u865b\u64ec\u5316\u7ba1\u7406\u5e73\u53f0 WebVirtMgr \u90e8\u7f72"},"content":{"rendered":"<h1 id=\"centos-7-2-%e4%b8%8b-kvm-%e8%99%9b%e6%93%ac%e5%8c%96%e7%ae%a1%e7%90%86%e5%b9%b3%e5%8f%b0-webvirtmgr-%e9%83%a8%e7%bd%b2-yLunQeezVk\">CentOS 7.2 \u4e0b KVM \u865b\u64ec\u5316\u7ba1\u7406\u5e73\u53f0 WebVirtMgr \u90e8\u7f72<\/h1>\n<p>\u96a8\u8457\u865b\u64ec\u5316\u6280\u8853\u7684\u5feb\u901f\u767c\u5c55\uff0cKVM\uff08Kernel-based Virtual Machine\uff09\u6210\u70ba\u4e86\u8a31\u591a\u4f01\u696d\u548c\u958b\u767c\u8005\u7684\u9996\u9078\u865b\u64ec\u5316\u89e3\u6c7a\u65b9\u6848\u3002KVM \u5141\u8a31\u7528\u6236\u5728 Linux \u7cfb\u7d71\u4e0a\u904b\u884c\u591a\u500b\u865b\u64ec\u6a5f\uff0c\u4e26\u4e14\u5176\u6027\u80fd\u548c\u7a69\u5b9a\u6027\u90fd\u76f8\u7576\u51fa\u8272\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 CentOS 7.2 \u4e0a\u90e8\u7f72 KVM \u865b\u64ec\u5316\u7ba1\u7406\u5e73\u53f0 WebVirtMgr\uff0c\u5e6b\u52a9\u7528\u6236\u66f4\u65b9\u4fbf\u5730\u7ba1\u7406\u865b\u64ec\u6a5f\u3002<\/p>\n<h2 id=\"%e7%92%b0%e5%a2%83%e6%ba%96%e5%82%99-yLunQeezVk\">\u74b0\u5883\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u4e4b\u524d\uff0c\u78ba\u4fdd\u60a8\u7684 CentOS 7.2 \u7cfb\u7d71\u5df2\u7d93\u66f4\u65b0\u5230\u6700\u65b0\u7248\u672c\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u66f4\u65b0\uff1a<\/p>\n<pre><code>sudo yum update -y<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u6aa2\u67e5\u60a8\u7684 CPU \u662f\u5426\u652f\u6301\u865b\u64ec\u5316\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u78ba\u8a8d\uff1a<\/p>\n<pre><code>egrep -c '(vmx|svm)' \/proc\/cpuinfo<\/code><\/pre>\n<p>\u5982\u679c\u8fd4\u56de\u7684\u6578\u5b57\u5927\u65bc 0\uff0c\u5247\u8868\u793a\u652f\u6301\u865b\u64ec\u5316\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%9d-kvm-%e5%92%8c%e7%9b%b8%e9%97%9c%e7%b5%84%e4%bb%b6-yLunQeezVk\">\u5b89\u88dd KVM \u548c\u76f8\u95dc\u7d44\u4ef6<\/h2>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88dd KVM \u53ca\u5176\u76f8\u95dc\u7d44\u4ef6\uff1a<\/p>\n<pre><code>sudo yum install -y qemu-kvm libvirt libvirt-python libguestfs-tools virt-install<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u555f\u52d5\u4e26\u8a2d\u7f6e libvirtd \u670d\u52d9\u81ea\u52d5\u555f\u52d5\uff1a<\/p>\n<pre><code>sudo systemctl start libvirtd\nsudo systemctl enable libvirtd<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-webvirtmgr-yLunQeezVk\">\u5b89\u88dd WebVirtMgr<\/h2>\n<p>WebVirtMgr \u662f\u4e00\u500b\u57fa\u65bc Web \u7684 KVM \u865b\u64ec\u5316\u7ba1\u7406\u5de5\u5177\uff0c\u80fd\u5920\u7c21\u5316\u865b\u64ec\u6a5f\u7684\u7ba1\u7406\u904e\u7a0b\u3002\u9996\u5148\uff0c\u5b89\u88dd\u5fc5\u8981\u7684\u4f9d\u8cf4\u5305\uff1a<\/p>\n<pre><code>sudo yum install -y git python-pip python-devel<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u514b\u9686 WebVirtMgr \u7684\u4ee3\u78bc\u5eab\uff1a<\/p>\n<pre><code>git clone https:\/\/github.com\/retspen\/webvirtmgr.git<\/code><\/pre>\n<p>\u9032\u5165 WebVirtMgr \u76ee\u9304\u4e26\u5b89\u88dd Python \u4f9d\u8cf4\uff1a<\/p>\n<pre><code>cd webvirtmgr\nsudo pip install -r requirements.txt<\/code><\/pre>\n<h2 id=\"%e9%85%8d%e7%bd%ae-webvirtmgr-yLunQeezVk\">\u914d\u7f6e WebVirtMgr<\/h2>\n<p>\u5728\u914d\u7f6e WebVirtMgr \u4e4b\u524d\uff0c\u9700\u8981\u8a2d\u7f6e\u4e00\u500b\u6578\u64da\u5eab\u3002\u9019\u88e1\u6211\u5011\u4f7f\u7528 SQLite \u4f5c\u70ba\u6578\u64da\u5eab\u3002\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b\u547d\u4ee4\u5275\u5efa\u6578\u64da\u5eab\uff1a<\/p>\n<pre><code>touch webvirtmgr.db<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u7de8\u8f2f\u914d\u7f6e\u6587\u4ef6\u4ee5\u8a2d\u7f6e\u6578\u64da\u5eab\u8def\u5f91\u548c\u5176\u4ed6\u53c3\u6578\u3002\u6253\u958b <code>webvirtmgr\/settings.py<\/code> \u6587\u4ef6\uff0c\u4e26\u6839\u64da\u9700\u8981\u9032\u884c\u4fee\u6539\u3002<\/p>\n<h2 id=\"%e5%95%9f%e5%8b%95-webvirtmgr-yLunQeezVk\">\u555f\u52d5 WebVirtMgr<\/h2>\n<p>\u5728\u914d\u7f6e\u5b8c\u6210\u5f8c\uff0c\u53ef\u4ee5\u555f\u52d5 WebVirtMgr\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u555f\u52d5 Flask \u670d\u52d9\uff1a<\/p>\n<pre><code>python run.py<\/code><\/pre>\n<p>\u9ed8\u8a8d\u60c5\u6cc1\u4e0b\uff0cWebVirtMgr \u6703\u5728 5000 \u7aef\u53e3\u904b\u884c\u3002\u60a8\u53ef\u4ee5\u901a\u904e\u700f\u89bd\u5668\u8a2a\u554f <code>http:\/\/your_server_ip:5000<\/code> \u4f86\u8a2a\u554f WebVirtMgr \u754c\u9762\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-yLunQeezVk\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u4ee5\u4e0a\u6b65\u9a5f\uff0c\u60a8\u5df2\u7d93\u6210\u529f\u5728 CentOS 7.2 \u4e0a\u90e8\u7f72\u4e86 KVM \u865b\u64ec\u5316\u7ba1\u7406\u5e73\u53f0 WebVirtMgr\u3002\u9019\u4f7f\u5f97\u865b\u64ec\u6a5f\u7684\u7ba1\u7406\u8b8a\u5f97\u66f4\u52a0\u7c21\u55ae\u548c\u9ad8\u6548\u3002\u7121\u8ad6\u662f\u5c0d\u65bc\u958b\u767c\u8005\u9084\u662f\u4f01\u696d\u7528\u6236\uff0c\u9019\u7a2e\u865b\u64ec\u5316\u89e3\u6c7a\u65b9\u6848\u90fd\u80fd\u63d0\u4f9b\u9748\u6d3b\u6027\u548c\u53ef\u64f4\u5c55\u6027\u3002<\/p>\n<p>\u5982\u679c\u60a8\u9700\u8981\u9032\u4e00\u6b65\u7684\u865b\u64ec\u5316\u89e3\u6c7a\u65b9\u6848\uff0c\u8acb\u8003\u616e\u6211\u5011\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2f VPS<\/a> \u670d\u52d9\uff0c\u70ba\u60a8\u7684\u696d\u52d9\u63d0\u4f9b\u7a69\u5b9a\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to deploy WebVirtMgr for KVM virtualization management on CentOS 7.2, simplifying your virtual machine management with a web interface.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-42944","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/42944","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=42944"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/42944\/revisions"}],"predecessor-version":[{"id":42945,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/42944\/revisions\/42945"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=42944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=42944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=42944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}