命令行安装KVM
查看libvirtd的状态:
[root@super67 ~]# /etc/init.d/libvirtd status
libvirtd (pid 2503) is running...
安装vnc:
[root@super67 ~]# yum install -y tigervnc
[root@super67 ~]# yum install -y virt-viewer
查看虚拟机状态:
[root@super67 ~]# virsh list --all
Id Name State
----------------------------------------------------
- www.linux1.cn shut off
准备镜像文件:
[root@super67 ~]# ll /var/lib/libvirt/images/ubuntu-16.04-desktop-amd64.iso
创建磁盘:
[root@super67 ~]# mkdir /var/lib/libvirt/disk/ -p
[root@super67 ~]# qemu-img create -f raw /var/lib/libvirt/disk/unbuntu16.raw 10G
Formatting '/var/lib/libvirt/disk/unbuntu16.raw', fmt=raw size=10737418240
安装虚拟机:
[root@super67 ~]# virt-install --name ubuntu16 --ram 1024 --vcpu=1 --disk path=/var/lib/libvirt/disk/unbuntu16.raw --accelerate --cdrom=/var/lib/libvirt/images/ubuntu-16.04-desktop-amd64.iso --network bridge=br0 --graphics vnc
"""
--name=ubuntu16 #指定guest的名字
--ram=1024 #指定内存大小
--vcpus=1 #指定cpu个数
--disk path=/xx/xx.xx #指定磁盘
--accelerate #加速
--cdrom /xx/xx.iso 指定镜像
--network bridge=br0 #bridge=xx , network:name ,user
--graphics vnc
--location= #directory ,nfs:host:/path ,http://host/path ,ftp://host/path
"""
配置vnc:
[root@super67 ~]# grep -Ev "^$|^#" /etc/libvirt/qemu.conf
vnc_listen = "0.0.0.0"
[root@super67 ~]# /etc/init.d/libvirtd restart
Stopping libvirtd daemon: [ OK ]
Starting libvirtd daemon: [ OK ]
[root@super67 ~]# netstat -antup|grep 5900
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 18413/qemu-kvm
(如果vnc只是监听127.0.0.1那么其他机器是无法使用vnc客户端连接进来的)
vnc远程连接:5900
[root@super67 ~]# vncviewer 127.0.0.1:5900

配置文件:
[root@super67 qemu]# pwd
/etc/libvirt/qemu
[root@super67 qemu]# ll
total 16
drwxr-xr-x 2 root root 4096 Sep 4 10:31 autostart #开机启动相关
drwx------ 3 root root 4096 Sep 4 09:46 networks #网络相关
-rw------- 1 root root 2290 Sep 4 13:13 ubuntu16.xml #虚拟机配置文件 .xml
-rw------- 1 root root 2574 Sep 4 10:32 www.linux1.cn.xml
虚拟机配置文件:
[root@super67 ~]# vim /etc/libvirt/qemu/ubuntu16.xml
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh edit ubuntu16
or other application using the libvirt API.
-->
<domain type='kvm'> #虚拟机类型
<name>ubuntu16</name> #虚拟机名字
<uuid>729109f3-6bcc-2f44-b1d3-4f9f6bface83</uuid>
<memory unit='KiB'>1048576</memory> #虚拟机最大内存
<currentMemory unit='KiB'>1048576</currentMemory> #虚拟机当前内存
<vcpu placement='static'>1</vcpu> #cpu个数
<os>
<type arch='x86_64' machine='rhel6.5.0'>hvm</type> #全虚拟化
<boot dev='hd'/> #引导类型hd硬盘引导,cdrom光盘引导
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/> #时间相关的
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/var/lib/libvirt/disk/unbuntu16.raw'/> #磁盘文件
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<disk type='block' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='bridge'> #网桥
<mac address='52:54:00:b0:48:17'/> #mac地址
<source bridge='br0'/> #网桥名
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'> #交互窗口
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</memballoon>
</devices>
</domain>
命令行安装KVM的更多相关文章
- 命令行安装kvm虚拟机、桥接网络、用virt-manager管理
宿主机CentOS Linux release 7.2.1511 (Core),内核3.10.0-327.el7.x86_64 1.配置宿主机网络桥接 想让虚拟机有自己的ip且外网可访问,需要在安装虚 ...
- 04.ubuntu下kvm 命令行安装64位ubuntu报"Couldn't find hvm kernel for Ubuntu tree."的问题
1.安装ubuntu时使用的virt-install的配置: virt-install \ --name test4 \ --ram 1024 \ --disk path=/data/01_ubunt ...
- Linux下命令行安装weblogic10.3.6
Linux下命令行安装weblogic10.3.6 一.安装前准备工作: 1.创建用户useradd weblogic;创建用户成功linux系统会自动创建一个和用户名相同的分组,并将该用户分到改组中 ...
- Oracle 图形化以及命令行安装
@(Oracle)[Install] Oracle 安装 相关版本说明 不同版本的Oracle需要安装在特定的系统版本之上. 如Oracle 11gR2的11.2.0.1.0需要安装在CentOS 5 ...
- Oracle 11gR2静默安装 & 命令行安装
静默安装 经常搭建Oracle测试环境,有时候觉得OUI(即图形界面)方式甚是繁琐,你得一步一步进行确认,所幸,Oracle支持静默安装.在我看来,它主要有两方面的好处:一.极大地提升了效率,尤其是批 ...
- VMware10中的CentOS6.5命令行安装VMwaretools工具启用windows与虚拟机中Linux系统的共享目录
VMware10中的CentOS6.5命令行安装VMwaretools工具启用windows与虚拟机中Linux系统的共享目录 一.描述 系统描述:win7旗舰版64位系统+VMware Workst ...
- Appium Mac 命令行安装
试过很多方法都失败,打算用命令行方式安装. 准备工作: 从 https://github.com/appium/appium下载appium版本的源码(.tar) 详见github_Appium1.6 ...
- macos 命令行安装 ipa
macos 命令行安装 ipa 苹果发神经后itunes已经无法在安装app了,如果有知道的兄弟可以告诉我啊 ideviceinstaller 使用这个开源项目可以在macos下安装app brew ...
- Linux系统--命令行安装weblogic10.3.6
Linux下命令行安装weblogic10.3.6 一.安装前准备工作: 1.创建用户useradd weblogic;创建用户成功linux系统会自动创建一个和用户名相同的分组,并将该用户分到改组中 ...
随机推荐
- MySQL 全文搜索支持, mysql 5.6.4支持Innodb的全文检索和类memcache的nosql支持
背景:搞个个人博客的全文搜索得用like啥的,现在mysql版本号已经大于5.6.4了也就支持了innodb的全文搜索了,刚查了下目前版本号都到MySQL Community Server 5.6.1 ...
- python 将pdf分页后插入至word中
所用技术 1. python编程基础 2. 使用pyPdf 3. 使用python操作word 4. 正则表达式的使用 5. windows的bat编程 下面是一个pyPdf库使用的示例: from ...
- (十)stm32中FSMC的使用(用于LCD)
FSMC全称“静态存储器控制器”. 使用FSMC控制器后,可以把FSMC提供的FSMC_A[25:0]作为地址线,而把FSMC提供的FSMC_D[15:0]作为数据总线. (1)当存储数据设为8位时, ...
- C# Winform ListView使用
以下内容均来自网上,个人收集整理,具体出处也难确认了,就没写出处了: 一.基本使用: listView.View = View.Details;//设置视图 listView.SmallImageLi ...
- MySQL支持的列类型
MySQL支持大量的列类型,它可以被分为3类:数字类型.日期和时间类型以及字符串(字符)类型.本节首先给出可用类型的一个概述,并且总结每个列类型的存储需求,然后提供每个类中的类型性质的更详细的描述. ...
- Oracle 11g必须开启的服务及服务详细介绍(转)
成功安装Oracle 11g数据库后,你会发现自己电脑运行速度会变慢,配置较低的电脑甚至出现非常卡的状况,通过禁止非必须开启的Oracle服务可以提升电脑的运行速度.那么,具体该怎么做呢? 按照win ...
- 【HTML5】Video + DOM
效果图: <!DOCTYPE html> <html> <body> <div style="text-align:center;"> ...
- SDCard存储
当需要访问SD卡上的文件时,需要按照如下步骤进行 *调用Environment.getExternalStorageState()判读手机上是否插入SD卡(返回MEDIA_MOUNTED则表示已经插入 ...
- 垂直的SeekBar:VerticalSeekBar
public class VerticalSeekBar extends AbsSeekBar { private Drawable mThumb; public interface OnSeekBa ...
- yuv rgb 像素格式1
===========大小============= 一般,直接采集到的视频数据是RGB24的格式 RGB24一帧的大小size=width×heigth×3 Byte, RGB32的size=wid ...