kvm部署

2021/6/22 6:28:16

本文主要是介绍kvm部署,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

kvm

  • 打开虚拟机虚拟化功能,添加一块100g的磁盘。增加处理器数量

image-20210619175713993

image-20210619175818044

  • kvm虚拟机

  • web控制界面
## 安装相关软件
[root@wed01 src]# yum install -y epel-release  #先安装epel源,要不git等一些插件安不上 
[root@wed01 src]# yum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx python-devel 


## 克隆github上的代码
[root@wed01 ~]# cd /usr/local/src/
[root@wed01 ~]# git clone git://github.com/retspen/webvirtmgr.git

##安装webvirtmgr
[root@wed01 ~]# cd /usr/local/src/webvirtmgr/
[root@wed01 webvirtmgr]# pip install -r requirements.txt


##检查sqlite3是否安装
[root@wed01 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()



//初始化帐号信息
[root@wed01 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):  #是否想现在创建
Please enter either "yes" or "no": yes
Username (leave blank to use 'root'):        #输入用户名
Email address: 1@2.com						 #邮箱
Password: 									 #密码
Password (again): 							 #再次输入密码
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 6 object(s) from 1 fixture(s)


##拷贝web网页至指定目录
[root@wed01 webvirtmgr]# mkdir /var/www
[root@wed01 webvirtmgr]# cp -r /usr/local/src/webvirtmgr /var/www/
[root@wed01 webvirtmgr]# chown -R nginx.nginx /var/www/webvirtmgr/


##生成密钥
[root@wed01 webvirtmgr]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:vCIGiZx+7fXMF0fpZLveKUozpMh3gGM1tOJp5oH5Ods root@wed01
The key's randomart image is:
+---[RSA 2048]----+
|         .       |
|        . .      |
|       . +    .  |
|....  +.= .  =   |
|.oo  o XS. .= .  |
|.  .. B =.+. +   |
| . .o..O.o =o .  |
|  ......O o.oo. .|
|     . . E..o..o |
+----[SHA256]-----+
[root@wed01 webvirtmgr]# ssh-copy-id 10.0.0.5


  • 配置web界面

image-20210621102551358

image-20210621102603985

image-20210621102702828

image-20210621102725192

image-20210621102750283

image-20210621102836022

image-20210621102914314

  • 用xftp把centos 7 的镜像传过来(演示略)


这篇关于kvm部署的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程