当前位置:网站首页>kvm部署
kvm部署
2022-08-02 12:11:00 【沐辰晨兮】
环境说明:
IP:192.168.149.10
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[[email protected] ~]# setenforce 0
[[email protected] ~]# sed -ri 's/^(SELINUX=).*/\1disabled/g' /etc/selinux/config
[[email protected] ~]# curl -o /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
[[email protected] ~]# sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[[email protected] ~]# sed -i 's/^enabled=.*/enabled=1/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[[email protected] ~]# yum -y install epel-release vim wget net-tools unzip zip gcc gcc-c++
验证CPU是否支持KVM;如果结果中有vmx(Intel)或svm(AMD)字样,就说明CPU的支持的
egrep -o 'vmx|svm' /proc/cpuinfo
//kvm安装
[[email protected] ~]# yum -y install qemu-kvm qemu-kvm-tools qemu-img virt-manager libvirt libvirt-python libvirt-client virt-install virt-viewer bridge-utils libguestfs-tools
//启动服务 并检查服务信息
[[email protected] ~]# systemctl start libvirtd
[[email protected] ~]# systemctl enable libvirtd
[[email protected] ~]# lsmod|grep kvm
[[email protected] ~]# virsh -c qemu:///system list
[[email protected]calhost ~]# virsh --version
[[email protected] ~]# virt-install --version
[[email protected] ~]# ln -s /usr/libexec/qemu-kvm /usr/bin/qemu-kvm
[[email protected] ~]# ll /usr/bin/qemu-kvm
[[email protected] ~]# lsmod |grep kvm
[[email protected] ~]# brctl show
Web界面安装
[[email protected] ~]# yum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx python-devel
//从github上下载webvirtmgr代码
[[email protected] ~]# cd /usr/local/src/
[[email protected] src]# git clone git://github.com/retspen/webvirtmgr.git
安装webvirtmgr //检查sqlite3是否安装
[[email protected] src]# cd webvirtmgr/
[[email protected] webvirtmgr]# pip install -r requirements.txt
[[email protected] webvirtmgr]# python
Python 2.7.5 (default, Nov 16 2020, 22:23:17)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> exit()
/初始化帐号信息
[[email protected] webvirtmgr]# python manage.py syncdb
WARNING:root:No local_settings file found.
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table servers_compute
Creating table instance_instance
Creating table create_flavor
You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes //问你是否创建超级管理员帐号
Username (leave blank to use 'root'): //指定超级管理员帐号用户名,默认留空为root
Email address: [email protected] //设置超级管理员邮箱
Password:1 //设置超级管理员密码
Password (again):1 //再次输入超级管理员密码
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 6 object(s) from 1 fixture(s)
//拷贝web网页至指定目录
并做免密登录
[[email protected] webvirtmgr]# mkdir /var/www
[[email protected] webvirtmgr]# cp -r /usr/local/src/webvirtmgr/ /var/www/
[[email protected] webvirtmgr]# chown -R nginx.nginx /var/www/webvirtmgr/
[[email protected] webvirtmgr]# ssh-keygen -t rsa
[[email protected] webvirtmgr]# ssh-copy-id 192.168.149.10
//端口转发
[[email protected] webvirtmgr]# ssh 192.168.149.10 -L localhost:8000:localhost:8000 -L localhost:6080:localhost:60
[[email protected] ~]# ss -antl
//配置nginx
[[email protected] ~]# vim /etc/nginx/nginx.conf
文件41行修改内容为localhost
[[email protected] ~]# vim /etc/nginx/conf.d/webvirtmgr.conf
修改配置文件 在其中添加以下内容
[[email protected] ~]# vim /var/www/webvirtmgr/conf/gunicorn.conf.py
查看即可 无需修改
//重启nginx
[[email protected] ~]# systemctl start nginx
[[email protected] ~]# ss -antl
//设置supervisor
[[email protected] ~]# vim /etc/supervisord.conf 注意:需对齐到文件最前面
//启动supervisor并设置开机自动启动
[[email protected] ~]# systemctl start supervisord
[[email protected] ~]# systemctl enable supervisord
[[email protected] ~]# systemctl status supervisord
//配置nginx用户
[[email protected] ~]# su - nginx -s /bin/bash
-bash-4.2$ touch ~/.ssh/config && echo -e "StrictHostKeyChecking=no\nUserKnownHostsFile=/dev/null" >> ~/.ssh/config
-bash-4.2$ chmod 0600 ~/.ssh/config
-bash-4.2$ ssh-copy-id [email protected]
[[email protected] ~]# vim /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
添加以下内容
[[email protected] ~]# chown -R root.root /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
[[email protected] ~]# systemctl restart nginx
[[email protected] ~]# systemctl restart libvirtd
验证web界面结果
用户名为root 密码为虚拟机密码
//确保bind绑定的是本机的8000端口\
边栏推荐
- JSP中include指令的功能简介说明
- JVM学习----垃圾回收调优
- Do you really understand the business process service BPass?
- 【Acunetix-Forgot your password】
- 运行yum报错Error: Cannot retrieve metalink for reposit
- 力扣35-搜索插入位置——二分查找
- 喜迎八一 《社会企业开展应聘文职人员培训规范》团体标准出版发行会暨橄榄枝大课堂上线发布会在北京举行
- Create your own app applet ecosystem with applet containers
- 7种最常用数据分析思维,解决95%的分析难题
- 解决anaconda下载pytorch速度极慢的方法
猜你喜欢
Problem solving in the process of using mosquitto
Create a devops CI/CD process using the kubesphere GUI
simulink PID自动整定
NVIDIA NeMo Metrics 轻量性能采集系统
Free Chinese-English Translation Software - Automatic Batch Chinese-English Translation Software Recommended Daquan
Swift中什么时候不能用 () 代替 Void 来使用
Process finished with exit code 1
jacoco的学习以及理解
手撸架构,网络 面试36问
力扣977-有序数组的平方——暴力法&双指针法
随机推荐
npm run dev 和 npm run serve区别
手撸架构,网络 面试36问
Crack detection technology based on deep learning
Lexicon 27 - Remove Elements - Simple Questions
服务器间传输文件
unique in numpy & pandas
Chapter 11 Documents
解决anaconda下载pytorch速度极慢的方法
QListView的使用
手撸架构,MongDB 面试50问
【Acunetix-忘记密码】
go源码之sync.Waitgroup
如何在 UE4 中制作一扇自动开启的大门
测试开发之路,我在大厂做测试这四年的感悟
智能图像分析-智能家用电器图像目标检测统计计数检测与识别-艾科瑞特科技(iCREDIT)
大疆P4M云遮挡矫正
According to the field classification Golang map array
npm WARN deprecated [email protected] This version of tar is no longer supported, and will not receive
Problem solving in the process of using mosquitto
免费的中英文翻译软件-自动批量中英文翻译软件推荐大全