{"id":42438,"date":"2024-10-03T13:26:31","date_gmt":"2024-10-03T05:26:31","guid":{"rendered":"https:\/\/server.hk\/cnblog\/42438\/"},"modified":"2024-10-03T13:26:31","modified_gmt":"2024-10-03T05:26:31","slug":"centos-6-2-%e4%b8%8b-kvm-%e7%ae%a1%e7%90%86%e5%b9%b3%e5%8f%b0-webvirtmgr-%e7%9a%84%e9%83%a8%e7%bd%b2","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/42438\/","title":{"rendered":"CentOS 6.2 \u4e0b KVM \u7ba1\u7406\u5e73\u53f0 WebVirtMgr \u7684\u90e8\u7f72"},"content":{"rendered":"<h1 id=\"centos-6-2-%e4%b8%8b-kvm-%e7%ae%a1%e7%90%86%e5%b9%b3%e5%8f%b0-webvirtmgr-%e7%9a%84%e9%83%a8%e7%bd%b2-vRznfevMYL\">CentOS 6.2 \u4e0b KVM \u7ba1\u7406\u5e73\u53f0 WebVirtMgr \u7684\u90e8\u7f72<\/h1>\n<p>\u5728\u865b\u64ec\u5316\u6280\u8853\u65e5\u76ca\u666e\u53ca\u7684\u4eca\u5929\uff0cKVM\uff08Kernel-based Virtual Machine\uff09\u4f5c\u70ba\u4e00\u7a2e\u9ad8\u6548\u7684\u865b\u64ec\u5316\u89e3\u6c7a\u65b9\u6848\uff0c\u53d7\u5230\u5ee3\u6cdb\u7684\u95dc\u6ce8\u3002WebVirtMgr \u662f\u4e00\u500b\u57fa\u65bc Web \u7684 KVM \u7ba1\u7406\u5e73\u53f0\uff0c\u80fd\u5920\u7c21\u5316\u865b\u64ec\u6a5f\u7684\u7ba1\u7406\u904e\u7a0b\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 CentOS 6.2 \u4e0a\u90e8\u7f72 WebVirtMgr\uff0c\u4ee5\u4fbf\u7528\u6236\u80fd\u5920\u8f15\u9b06\u7ba1\u7406\u5176\u865b\u64ec\u6a5f\u3002<\/p>\n<h2 id=\"%e5%89%8d%e6%9c%9f%e6%ba%96%e5%82%99-vRznfevMYL\">\u524d\u671f\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u90e8\u7f72\u4e4b\u524d\uff0c\u78ba\u4fdd\u60a8\u7684 CentOS 6.2 \u7cfb\u7d71\u5df2\u7d93\u5b89\u88dd\u4e86 KVM \u548c\u76f8\u95dc\u7684\u4f9d\u8cf4\u5305\u3002\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5 KVM \u662f\u5426\u5df2\u5b89\u88dd\uff1a<\/p>\n<pre><code>lsmod | grep kvm<\/code><\/pre>\n<p>\u5982\u679c\u6c92\u6709\u8f38\u51fa\uff0c\u5247\u9700\u8981\u5b89\u88dd KVM\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u5b89\u88dd\uff1a<\/p>\n<pre><code>yum install qemu-kvm libvirt libvirt-python libguestfs-tools<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u555f\u52d5 libvirt \u670d\u52d9\uff1a<\/p>\n<pre><code>service libvirtd start<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-webvirtmgr-vRznfevMYL\">\u5b89\u88dd WebVirtMgr<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u6211\u5011\u5c07\u5b89\u88dd WebVirtMgr\u3002\u9996\u5148\uff0c\u78ba\u4fdd\u7cfb\u7d71\u5df2\u7d93\u5b89\u88dd\u4e86 Git \u548c\u5176\u4ed6\u5fc5\u8981\u7684\u4f9d\u8cf4\u5305\uff1a<\/p>\n<pre><code>yum install git python-flask python-requests<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u5f9e GitHub \u4e0a\u514b\u9686 WebVirtMgr \u7684\u4ee3\u78bc\uff1a<\/p>\n<pre><code>git clone https:\/\/github.com\/retspen\/webvirtmgr.git<\/code><\/pre>\n<p>\u9032\u5165\u514b\u9686\u7684\u76ee\u9304\uff1a<\/p>\n<pre><code>cd webvirtmgr<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u914d\u7f6e WebVirtMgr \u7684\u8a2d\u7f6e\u3002\u7de8\u8f2f\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre><code>nano webvirtmgr\/config.py<\/code><\/pre>\n<p>\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u60a8\u9700\u8981\u8a2d\u7f6e\u6578\u64da\u5eab\u9023\u63a5\u548c\u5176\u4ed6\u53c3\u6578\u3002\u78ba\u4fdd\u60a8\u5df2\u7d93\u5b89\u88dd\u4e86 SQLite \u6216\u5176\u4ed6\u6578\u64da\u5eab\u7cfb\u7d71\u3002<\/p>\n<h2 id=\"%e9%85%8d%e7%bd%ae-nginx-%e4%bd%9c%e7%82%ba%e5%8f%8d%e5%90%91%e4%bb%a3%e7%90%86-vRznfevMYL\">\u914d\u7f6e Nginx \u4f5c\u70ba\u53cd\u5411\u4ee3\u7406<\/h2>\n<p>\u70ba\u4e86\u80fd\u5920\u901a\u904e Web \u700f\u89bd\u5668\u8a2a\u554f WebVirtMgr\uff0c\u5efa\u8b70\u4f7f\u7528 Nginx \u4f5c\u70ba\u53cd\u5411\u4ee3\u7406\u3002\u9996\u5148\uff0c\u5b89\u88dd Nginx\uff1a<\/p>\n<pre><code>yum install nginx<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u7de8\u8f2f Nginx \u914d\u7f6e\u6587\u4ef6\u4ee5\u8a2d\u7f6e\u53cd\u5411\u4ee3\u7406\uff1a<\/p>\n<pre><code>nano \/etc\/nginx\/conf.d\/webvirtmgr.conf<\/code><\/pre>\n<p>\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5167\u5bb9\uff1a<\/p>\n<pre><code>server {\n    listen 80;\n    server_name your_domain.com;\n\n    location \/ {\n        proxy_pass http:\/\/127.0.0.1:8000;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n    }\n}<\/code><\/pre>\n<p>\u4fdd\u5b58\u4e26\u9000\u51fa\u7de8\u8f2f\u5668\uff0c\u7136\u5f8c\u555f\u52d5 Nginx\uff1a<\/p>\n<pre><code>service nginx start<\/code><\/pre>\n<h2 id=\"%e5%95%9f%e5%8b%95-webvirtmgr-vRznfevMYL\">\u555f\u52d5 WebVirtMgr<\/h2>\n<p>\u73fe\u5728\u53ef\u4ee5\u555f\u52d5 WebVirtMgr \u4e86\u3002\u5728 WebVirtMgr \u76ee\u9304\u4e2d\u904b\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>python run.py<\/code><\/pre>\n<p>\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u60a8\u61c9\u8a72\u80fd\u5920\u901a\u904e\u700f\u89bd\u5668\u8a2a\u554f WebVirtMgr\uff0c\u7db2\u5740\u70ba http:\/\/your_domain.com\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-vRznfevMYL\">\u7e3d\u7d50<\/h2>\n<p>\u672c\u6587\u4ecb\u7d39\u4e86\u5982\u4f55\u5728 CentOS 6.2 \u4e0a\u90e8\u7f72 KVM \u7ba1\u7406\u5e73\u53f0 WebVirtMgr\u3002\u901a\u904e\u9019\u4e9b\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u8f15\u9b06\u7ba1\u7406\u865b\u64ec\u6a5f\uff0c\u63d0\u5347\u5de5\u4f5c\u6548\u7387\u3002\u82e5\u60a8\u9700\u8981\u66f4\u9ad8\u6548\u7684\u865b\u64ec\u5316\u89e3\u6c7a\u65b9\u6848\uff0c\u8003\u616e\u4f7f\u7528 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u670d\u52d9\uff0c\u9019\u5c07\u70ba\u60a8\u7684\u696d\u52d9\u63d0\u4f9b\u7a69\u5b9a\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u90e8\u7f72 CentOS 6.2 \u4e0b\u7684 KVM \u7ba1\u7406\u5e73\u53f0 WebVirtMgr\uff0c\u8f7b\u677e\u5b9e\u73b0\u865a\u62df\u673a\u7ba1\u7406\u4e0e\u76d1\u63a7\uff0c\u63d0\u5347\u670d\u52a1\u5668\u7ba1\u7406\u6548\u7387\u3002<\/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-42438","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/42438","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=42438"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/42438\/revisions"}],"predecessor-version":[{"id":42439,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/42438\/revisions\/42439"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=42438"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=42438"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=42438"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}