## 字符界面部署和使用kvm
检查当前服务器 CPU 是否支持虚拟化
grep -E 'svm|vmx' /proc/cpuinfo
安装相关软件
yum -y install qemu-kvm libvirt libvirt-python libguestfs-tools virt-install virt-manager
启动服务并授权开机自启
systemctl enable libvirtd && systemctl start libvirtd
验证 kvm 的内核模块是否加载
lsmod |grep kvm
方法一:
首先需要脚本所需要的文件:如下
1.CentOS的iso镜像
2.ks.cfg文件如下:
#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
rootpw --iscrypted $1$KXeyOPUO$5JlUe3pPpi.hplHB71JdX/
# 系统语言
#lang zh_CN.UTF-8
lang en_US
# System authorization information
auth --useshadow --passalgo=sha512
# Use CDROM installation media
#cdrom
# Use text mode install
# 使用字符界面安装操作系统
text
# Do not configure the X Window System
# 不配置图形界面系统
skipx
# SELinux configuration
selinux --disabled
# Firewall configuration
firewall --disabled
# 设置动态获取 IP
network --bootproto=dhcp --device=eth0 --onboot=on
#network --hostname=HOSNAME
# 设置静态 IP
# network --bootproto=static --device=eth0 --gateway=192.168.122.1 --ip=192.168.122.100 --nameserver=192.168.122.1 --netmask=255.255.255.0 --activate
# 系统安装完成后 重启系统
#halt
reboot
# System timezone 系统时区
timezone Asia/Shanghai
# System services 系统启动时候自动启动的服务
services --enable=