使用wok kimchi插件管理kvm(编译安装)

对于KVM(kernel-based virtual machine)大家并不陌生,它是基于内核的虚拟机,在测试或者生产环境中经常用到,由于管理起来不是很方便,我在这里推荐一个kvm web管理工具。

什么是Wok?

Wok基于cherrypy的web框架,可以通过一些插件来进行扩展,例如:虚拟化管理、主机管理、系统管理。它可以在任何支持HTML5的网页浏览器中运行。

什么是Kimchi?

Kimchi是一个基于HTML5的KVM管理工具,是Wok的一个插件(使用Kimchi前一定要先安装了wok),通过Kimchi可以更方便的管理KVM。

github地址:https://github.com/kimchi-project

当前环境介绍:

vm虚拟机安装的Centos7.4(桌面版安装),vm勾选虚拟化Inter VT-x/EPT或AMD-V/RVI(V)

临时关闭selinux

setenforce 0

永久关闭selinux

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

关闭防火墙(或自行开放相应端口)

systemctl stop firewalld.service

正文开始:

一、编译安装nginx
1、配置好yum源,安装依赖

yum install wget gcc gcc-c++ pcre pcre-devel openssl openssl-devel zlib zlib-devel epel-release

2、创建nginx启动用户

useradd -s /bin/false -M www

3、下载解压nginx

cd /usr/local/src/wget http://nginx.org/download/nginx-1.12.2.tar.gztar zxf nginx-1.12.2.tar.gz

4、编译nginx

cd /usr/local/src/nginx-1.12.2./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_modulemakemake install

5、添加环境变量

ln -sv /usr/local/nginx/sbin/nginx /usr/local/sbin/

6、设置systemctl

vi /usr/lib/systemd/system/nginx.service

[Unit]Description=nginxAfter=network.target[Service]Type=forkingPIDFile=/usr/local/nginx/logs/nginx.pidExecStart=/usr/local/nginx/sbin/nginxExecReload=/usr/local/nginx/sbin/nginx -s reloadExecStop=/usr/local/nginx/sbin/nginx -s stopPrivateTmp=true[Install]WantedBy=multi-user.target

二、配置nginx
1、编辑nginx配置文件

vi /usr/local/nginx/conf/nginx.conf

http{......include vhost/*.conf;}

2、创建虚拟机

mkdir /usr/local/nginx/conf/vhostcd /usr/local/nginx/conf/vhost

vi wok.conf

client_max_body_size 4194304k;proxy_connect_timeout       10m;proxy_send_timeout          10m;proxy_read_timeout          10m;send_timeout                10m;

map $http_upgrade $connection_upgrade {

default upgrade;
'' close;

}
upstream websocket {

server 127.0.0.1:64667;

}
server {

listen 0.0.0.0:8001 ssl;

ssl_certificate /etc/wok/wok-cert.pem;
ssl_certificate_key /etc/wok/wok-key.pem;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:@STRENGTH';
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/wok/dhparams.pem;

# Session timeout value must be properly set in /etc/wok/wok.conf as well
ssl_session_timeout 10m;

add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";

location / {

    # Default cherrypy port for Wok is 8010
    # DO NOT forget to update cherrypy_port parameter in /etc/wok/wok.conf
    # when changing this value
    proxy_pass http://127.0.0.1:8010;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    # Update location path for https for relative path
    # e.g.: proxy_redirect http://127.0.0.1:8010/ https://$host:8001/wok/;
    proxy_redirect http://127.0.0.1:8010/ https://$host:8001/;
}

# Update location path for relative path
# e.g.: localtion /wok/websockify
location /websockify {
    proxy_pass http://websocket;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
}

}
server {

listen 0.0.0.0:8000;
rewrite ^/(.*)$ https://$host:8001/$1 redirect;

}

三、编译安装wok
1、安装依赖

yum install gettext-devel git rpm-python python-psutil sos python-lxml libxslt pyparted python-cherrypy python-configobj python-unittest2 python-ordereddict pyflakes python-pep8 python-requests automake PyPAM fontawesome-fonts python-cheetah python-jsonschema python-websockify python-ldap m2crypto gcc make autoconf rpm-build python-pip libvirt-python libvirt libvirt-daemon-config-network qemu-kvm python-ethtool python-ipaddr nfs-utils iscsi-initiator-utils python-libguestfs libguestfs-tools novnc spice-html5 python-magic python-pillow python-paramiko

2、安装pip模块
在用户目录下创建.pip文件夹

cd /rootmkdir ~/.pip

然后在该目录下创建pip.conf文件

vi ~/.pip/pip.conf

[global]trusted-host=mirrors.aliyun.comindex-url=http://mirrors.aliyun.com/pypi/simple/

接下来再通过pip安装numpy,如果直接pip安装numpy的话速度会很慢

pip install numpy

3、下载wok源码包并编译wok

cd /usr/local/src/wget http://down.whsir.com/downloads/wok-2.5.0.tar.gztar zxf wok-2.5.0.tar.gzcd wok-2.5.0./autogen.sh --systemmakemake installpython src/wokd

注意:执行python src/wokd后会生成证书,生成完成后需要手动ctrl+c结束
四、编译kimchi

cd /usr/local/src/wget http://down.whsir.com/downloads/kimchi-2.5.0.tar.gztar zxf kimchi-2.5.0.tar.gzcd kimchi-2.5.0./autogen.sh --systemmakemake install

五、最后
启动wok

systemctl start wokd

访问https://IP:8001即可看到登录页面,此登录的帐号密码为当前系统的帐号密码

此时可以通过Virtualization来管理kvm了

关于kvm安装可参考:https://blog.whsir.com/post-286.html

时间: 2024-08-01 23:52:40

使用wok kimchi插件管理kvm(编译安装)的相关文章

使用wok kimchi插件管理kvm(rpm安装)

对于KVM(kernel-based virtual machine)大家并不陌生,它是基于内核的虚拟机,在测试或者生产环境中经常用到,由于管理起来不是很方便,我在这里推荐一个kvm web管理工具. 什么是Wok? Wok基于cherrypy的web框架,可以通过一些插件来进行扩展,例如:虚拟化管理.主机管理.系统管理.它可以在任何支持HTML5的网页浏览器中运行. 什么是Kimchi? Kimchi是一个基于HTML5的KVM管理工具,是Wok的一个插件(使用Kimchi前一定要先安装了wo

LAMP架构的编译安装及错误详解

本次试验用的是新安装的系统,以此保证纯净,站在第一次编译安装lamp的角度,分析各种错误,从错误开始入手. 至于lamp是干什么用的,我就不赘述了,直接开始. 本文中的软件我都已经下好了,并且打包好了,如果有需要的朋友,可以自己下载我的软件包 首先交代一下系统的版本 [root@localhost libevent-2.0.18-stable]# lsb_release -a LSB Version:    :core-4.0-ia32:core-4.0-noarch:graphics-4.0-

magento1.4 -- 预编译(Compilation)开启后后台插件管理不能访问的bug

预编译(Compilation)功能在1.3时代就已经存在于Magento系统中,开启后能大幅提高Magento系统的运行速度.在1.4以前这个功能一直是beta版,到1.4终于把beta这个词去掉了,也就意味着这个功能已经成熟,但是经过我反复测试,在新安装完的干净系统中开启预编译(Compilation)后,后台插件管理(Magento Connect Manager)不能访问,报错信息如下: Fatal error: main() [function.require]: Failed ope

Xcode插件管理器Alcatraz的使用

Xcode插件管理器Alcatraz的使用   下载地址 https://github.com/alcatraz/Alcatraz   下载软件包   解压以及编译   重启Xode并Load Bundle   安装插件   完全关闭Xcode并Load Bundles   Done!

Linux下MySQL源码编译安装(eg:mysql-5.6.27.tar.gz )

Linux下MySQL源码安装(eg:mysql-5.6.27.tar.gz ): 1:准备MySQL源码安装包: mysql-5.6.27.tar.gz.cmake-3.3.2.tar.gz.ncurses-6.0.tar.gz 注:centos请安装: yum install -y ncurses-devel yum install -y perl-Module-Install.noarch 网址: https://cmake.org/download/ ftp://invisible-is

Nginx编译安装之自定义google_perftools not found

OS:CentOS 6.3 X 64  >> Nginx 1.4.7 >> google_perftools 2.1 >> libunwind 1.1 错误提示:  代码如下 复制代码 checking for zlib library - found checking for Google perftools - not found checking for Google perftools in /usr/local/gperftools - not found c

通过shell、python脚本管理 kvm 虚拟机

一个想法: 1 python2.7 2 python的web框架 bottle 3 shell脚本管理kvm 组合在一起就可以了~ 这段时间我会用bottle 简单的实现管理kvm 主机,开源出去的~ 性能烂的话,别怪我~ 管理kvm主机完全可以在页面上完成,国外有个人用django写了这套程序,感觉还不错,只是稍复杂,bug有点多....  个人觉得 自己开写一套简单的,python本身有kvm的库,大家要是觉得麻烦的话,也可以用os模块,调用virsh的命令来管理kvm主机,这完全是可行的~

源码编译安装MySQL5.6.10最佳实践

  1安装cmake MySQL从5.5版本开始,通过./configure进行编译配置方式已经被取消,取而代之的是cmake工具. 因此,我们首先要在系统中源码编译安装cmake工具. # wget http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz # tar zxvf cmake-2.8.7.tar.gz # cd cmake-2.8.7 # ./configure # make # make install 1.1cmake命令语法 1.

源码编译安装 MySQL 5.5.x 实践(转)

1.安装cmakeMySQL从5.5版本开始,通过./configure进行编译配置方式已经被取消,取而代之的是cmake工具.因此,我们首先要在系统中源码编译安装cmake工具. # wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz # tar zxvf cmake-2.8.4.tar.gz # cd cmake-2.8.4 # ./configure# make# make install 2.确保以下所需系统软件包已经被安装通过