一、准备工作

安装wget和vim

yum install -y wget vim

修改yum源为阿里源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

sed -i  's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo

yum clean all

yum makecache

检查是否支持虚拟化
egrep '(vmx|svm)' /proc/cpuinfo
关闭SELinux,将 /etc/sysconfig/selinux 中的 SELinux=enforcing 修改为 SELinux=disabled

安装系统基本包
yum install epel-release net-tools vim unzip zip wget ftp -y
[root@xuegod72 ~]# yum grouplist "virtualization Host" -y
Loaded plugins: fastestmirror
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.ustc.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Available Environment Groups:
Virtualization Host
Done
[root@xuegod72 ~]# yum list virt-manager xorg-x11-xauth
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.ustc.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Available Packages
virt-manager.noarch 1.4.0-2.el7 base
xorg-x11-xauth.x86_64 1:1.0.9-1.el7 base
[root@xuegod72 ~]# yum groupinstall "Virtualization Host" -y
[root@xuegod72 ~]# yum install -y virt-manager xorg-x11-xauth
[root@xuegod72 ~]# yum install -y xorg-x11-font-utils xorg-x11-server-utils xorg-x11-utils xorg-x11-xauth

二、安装桌面(可选)

yum groupinstall "DevelopmentTools"
yum groupinstall "Virtualization" "Virtualization Client""Virtualization Platform"
yum -y groupinstall "X Window System"
yum -y groupinstall "GNOME Desktop"
早版本中可能是这个名字"GNOME Desktop Environment",使用yum grouplist可以查看可用的组

这里是“GNOME Desktop”,所以使用命令yum -y groupinstall "GNOME Desktop" 安装

yum -y groupinstall chinese-support (这个是中文包)如果最小化安装时选择中文包,这里可以不装。

startx或者init 5,就OK。

三、安装KVM虚拟机

(一)使用virt-manager安装

[root@xuegod72 ~]# vrit-manager

出现虚拟机管理器界面

在QEMU/KVM那儿鼠标右键,选择New

这里可以先传一个镜像文件到/var/lib/libvirt/images路径下,点 "Browse"就可以看到

点 + 号,创建磁盘

选择上传的镜像

设置内存和CPU

这里选择刚创建的虚拟磁盘

设置KVM名称和网络

设置Display Spice如下

Apply之后点击 

开始安装

注: KVM安装完成后可能ping不通外网,但是可以上网(可以使用yum安装软件)

(二)文本字符安装

安装 vnc客户端软件,方便远程连接正在安装中的虚拟机界面:

[root@xuegod72 ~]# yum install tigervnc -y

创建硬盘

[root@vm1 images]#  qemu-img create -f qcow2 /var/lib/libvirt/images/kvm01.img 20G

安装kvm

[root@vm1 images]# virt-install --name=kvm01 --ram 6144 --vcpus=2 --disk path=/var/lib/libvirt/images/kvm01.img,format=qcow2,size=20 --network bridge=br0  --os-type=linux --cdrom /var/lib/libvirt/images/CentOS-7-x86_64-Minimal-1611.iso --vnc --vnclisten=0.0.0.0 --vncport=5900

安装时连接KVM方法一:

[root@xuegod72 ~]# vncviewer 127.0.0.1

注:KVM中的vnc默认绑定的是本机127.0.0.1,如果其他机器想用vnc客户端访问这台kvm服务器正在安装的虚拟机,需要把vnc绑定到服务器的IP地址或者绑定到全局0.0.0.0

修改vnc监听IP地址为0.0.0.0,即本机所有的IP地址都监听5900端口

[root@xuegod72 ~]# vim /etc/libvirt/qemu.conf

将第12行的注释取消掉

vnc_listen = "0.0.0.0"

重启服务

[root@xuegod72 ~]# systemctl restart libvirtd

方法二:在windows系统上安装vncviewer 客户端连接

Expert选项卡ColorLevel选项修改为rgb222

修改KVM监听的端口

修改kvm.xml

<graphics type='vnc' port='5900' autoport='no' listen='0.0.0.0'>

<listen type='address' address='0.0.0.0'/>

</graphics>

双击就可以连接

创建快照

[root@vm1 images]# virsh snapshot-create kvm01

查看快照

[root@vm1 images]# virsh snapshot-list kvm01

Name                 Creation Time             State

------------------------------------------------------------

1502871731           2017-08-16 16:22:11 +0800 shutoff

恢复快照

[root@vm1 images]# virsh domstate kvm01

CentOS 7.3最小系统安装KVM的更多相关文章

  1. CentOS 7.3.1611系统安装配置图解教程

    操作系统:CentOS 7.3.1611 IP地址:192.168.21.130 网关:192.168.21.2 DNS:8.8.8.8 8.8.4.4 备注: CentOS 7.x系列只有64位系统 ...

  2. CentOS 7.6最小化安装(系统盘和数据盘分离安装)

    CentOS 7.6最小化安装(系统盘和数据盘分离安装) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.创建虚拟机 鉴于大家使用的平台操作系统可能不尽相同,博主精力有限,仅演示 ...

  3. CentOS 6,7最小化安装后再安装图形界面

    CentOS 6.2最小化安装后再安装图形界面 在安装CentOS 6.2时发现它没有提示我要怎么安装,而是“自作主张”地给我选择了最小化安装,结果装完之后只有终端界面,因为有时候不得不用图形界面,所 ...

  4. Win7+ubuntu kylin+CentOS 6.5三系统安装图文教程

    Win7+ubuntu kylin+CentOS 6.5三系统安装图文教程 引言:原本机子上已经装好了win7+Ubuntu Kylin 由win7引导,而不是Ubuntu的grub引导的双系统(安装 ...

  5. CentOS 6.x 最小化安装推荐安装的依赖包和修改内核参数

    CentOS 6.x 最小化安装推荐安装的依赖包 我在日常工作中,新建的xenserver的虚拟机,CentOS release 6.9 (Final)操作系统,采用最小化安装,后续很多操作需要各种依 ...

  6. CentOS 7 在最小化安装之后进行安装Apache服务,httpd-2.4.34

    此博文是CentOS 7 在最小化安装之后进行安装Apache服务的操作步骤,httpd版本为httpd-2.4.34. 一.基本服务环境搭建 安装apache需要的基本环境:apr apr-util ...

  7. 基于CentOS 7下最小化安装的操作系统搭建Zabbix3.0环境

    环境说明 系统版本:CentOS Linux release 7.3.1611 (Core) 内核版本:3.10.0-514.el7.x86_64 Httpd版本:Apache/2.4.6 (Cent ...

  8. Centos 7 最小化kvm部署

    1.检查CPU是否支持虚拟化 sh-4.2# grep -E '(vmx|svm)' /proc/cpuinfo # 若是无任何显示,则表示CPU不支持kvm虚拟化 2.关闭selinux sh-4. ...

  9. CentOS安装-(CentOS7)最小化安装

    镜像:CentOS-7-x86_64-DVD-1908.iso 1.将安装光盘插入服务器,开机会读取系统安装程序,选择 Install CentOS 7 2.安装过程是图形界面,可以选择熟悉的语言执行 ...

随机推荐

  1. [CSS] Build Responsive CSS Layouts with Tachyons

    Building responsive css layouts is critical in any modern website. Tachyons makes this easy by desig ...

  2. 【Windows Defender Antivirus Service 永久禁用 】

    cmd 管理员运行 执行 reg add “HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender” /v “DisableAn ...

  3. gcc for Windows 开发环境介绍

    导读: 在Windows操作系统下的gcc 第一节 GCC家族概览 GCC是一个原本用于Unix-like系统下编程的编译器. 只是,如今GCC也有了很多Win32下的移植版本号.所以,或许对于很多W ...

  4. System and method for dynamically adjusting to CPU performance changes

    FIELD OF THE INVENTION The present invention is related to computing systems, and more particularly ...

  5. hexo从零配置next全纪录

    1.按照官网按照hexo: 2.下载next(目前使用的是最新发布版本6.4.1),解压后重命名为next,放在hexo工程themes目录下: 3.网站配置文件_config.yml中,改成them ...

  6. @AspectJ support (good)

    AspectJ类型匹配的通配符:*:匹配任何数量字符:..:匹配任何数量字符的重复,如在类型模式中匹配任何数量子包:而在方法参数模式中匹配任何数量参数.+:匹配指定类型的子类型:仅能作为后缀放在类型模 ...

  7. springCloud你要了解的都在这(方向性)

    Spring Cloud作为一套微服务治理的框架,几乎考虑到了微服务治理的方方面面,之前也写过一些关于Spring Cloud文章,主要偏重各组件的使用,本次分享主要解答这两个问题:Spring Cl ...

  8. Android 它们的定义View

    安卓开发过程,安卓官方控制有时来自往往不能满足我们的需求.这一次,我必须定义自己.下面我们就来看看他们的定义View: package com.example.myview; import andro ...

  9. Struts2——(5)转发和重定向(跨业务模块)

    一.重定向redirect(默认是转发dispatcher)和转发的区别? 1.重定向浏览器的网址发生变化(相当于请求了两次),转发浏览器的网址不发生变化(只请求了一次). 2.重定向的过程:发送请求 ...

  10. idea 搭建 SpringBoot 集成 mybatis

    编译器:IDEA2018.2.3 环境:win10,jdk1.8,maven3.4 数据库:mysql 5.7 备注:截图较大,如果看不清,可以在图片上右键=>在新标签页中打开   查看高清大图 ...