原创博文
安装配置KVM http://www.cnblogs.com/elvi/p/7718574.html
web管理kvm http://www.cnblogs.com/elvi/p/7718582.html
kvm系统安装 http://www.cnblogs.com/elvi/p/7718623.html
KVM克隆&快照 http://www.cnblogs.com/elvi/p/7718628.html
web管理kvm ,安装webvirtmgr
# web管理kvm ,安装webvirtmgr#安装基础组件yum install epel-releaseyum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx#安装数据库yum install sqlite python-sqlite*#WebVirtMgr安装及初始化配置cd /usr/local/src/git clone git://github.com/retspen/webvirtmgr.gitzip -r webvirtmgr.zip ?webvirtmgr #备份#将WebVirtMgr复制到系统默认的web服务目录:mkdir -pv /var/wwwcp -R /usr/local/src/webvirtmgr /var/www/#cp -r webvirtmgr/ /var/www/cd /var/www/webvirtmgrpip install -r requirements.txt #安装Django ./manage.py syncdb ?#django进行环境配置 ./manage.py collectstatic #生成配置文件# ./manage.py createsuperuser #添加管理员账号 kvm@kvm2017# ./manage.py changepassword kvm #修改用户kvm的密码###############启动django#参考http://itfish.net/article/58805.htmlcd /var/www/webvirtmgr ./manage.py runserver 0.0.0.0:8000#访问:http://x.x.x.x:8000 (用 ./manage.py createsuperuser创建的用户)# nginx代理配置文件service httpd stopvim /etc/nginx/conf.d/kvm.conf# kvm webserver {listen 80 default_server;server_name $hostname;#access_log /var/log/nginx/webvirtmgr_access_log;location /static/ { ???root /var/www/webvirtmgr/webvirtmgr; # or /srv instead of /var ???expires max; ???}location / { ???proxy_pass http://127.0.0.1:8000; ???proxy_set_header X-Real-IP $remote_addr; ???proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for; ???proxy_set_header Host $host:$server_port; ???proxy_set_header X-Forwarded-Proto $remote_addr; ???proxy_connect_timeout 600; ???proxy_read_timeout 600; ???proxy_send_timeout 600; ???client_max_body_size 1024M; # Set higher depending on your needs ???}}#mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bakchkconfig nginx on /etc/init.d/nginx restartservice nginx restartchown -R nginx:nginx /var/www/webvirtmgr##############设置supervisor进程管理cp /etc/supervisord.conf /etc/supervisord.conf.bakvim /etc/supervisord.conf #在文件末尾添加如下;#KVM[program:webvirtmgr];#启动8000端口command=/usr/bin/python /var/www/webvirtmgr/manage.py run_gunicorn -c /var/www/webvirtmgr/conf/gunicorn.conf.pydirectory=/var/www/webvirtmgrautostart=trueautorestart=truelogfile=/var/log/supervisor/webvirtmgr.loglog_stderr=trueuser=nginx[program:webvirtmgr-console];#启动6080端口(这是控制台vnc端口)command=/usr/bin/python /var/www/webvirtmgr/console/webvirtmgr-consoledirectory=/var/www/webvirtmgrautostart=trueautorestart=truestdout_logfile=/var/log/supervisor/webvirtmgr-console.logredirect_stderr=trueuser=nginx;#KVMgrep bind /var/www/webvirtmgr/conf/gunicorn.conf.py #确保下面bind绑定的是本机的8000端口# ???bind = ‘127.0.0.1:8000‘ ?#远程无法访问sed -i "/^bind/cbind = ‘0.0.0.0:8000‘" /var/www/webvirtmgr/conf/gunicorn.conf.py |grep bind#supervisor以WEB方式监控管理进程 [inet_http_server];#port=127.0.0.1:9009修改为如下port=*:9009username=userpassword=123# vim /etc/rc.local ???# /usr/sbin/setsebool httpd_can_network_connect truechkconfig supervisord on #设置开机启动/etc/init.d/supervisord restart #启动进程#报错,重新安装supervisoryum remove supervisor #卸载yum安装的yum install supervisor -y#pip install supervisor #安装#pip uninstall supervisor #卸载pip安装的模块service supervisord restartlsof -i:8000 #查看端口是否启动service nginx restart##########################################KVM被管理端配置#设置tcp ip链接curl http://retspen.github.io/libvirt-bootstrap.sh | sudo shsudo saslpasswd2 -a libvirt kvm #新建kvm用户kvm@kvmsudo sasldblistusers2 -f /etc/libvirt/passwd.db #查看账号 ???kvm@kvm.test: userPassword#sudo saslpasswd2 -a libvirt -d kvm #删除账号kvmvirsh -c qemu+tcp://127.0.0.1/system nodeinfo #输入账户@hostname+密码验证#登录web,Add Connection,TCP链接,填写ip、用户、密码即可###设置ssh链接太麻烦……#########################################################centos7#安装配置supervisordsystemctl restart supervisordsystemctl stop supervisord systemctl enable supervisord.service #开机启动
web管理kvm ,安装webvirtmgr
原文地址:http://www.cnblogs.com/elvi/p/7718582.html