这是我参与11月更文挑战的第1天,活动详情查看:2021最后一次更文挑战
0x00 协议比较
在进行SPICE操作之前,对目前常用的协议VNC/SPICE/RDP三种,进行简单的比较。 协议比较
| SPICE | VNC | RDP | |
|---|---|---|---|
| BIOS屏幕显示 | 能 | 能 | 不能 |
| 全彩支持 | 能 | 能 | 能 |
| 更改分辨率 | 能 | 能 | 能 |
| 多显示器 | 多显示器支持(高达4画面) | 只有一个屏幕 | 多显示器支持 |
| 图像传输 | 图像和图形传输 | 图像传输 | 图像和图形传输 |
| 视频播放支持 | GPU加速支持 | 不能 | GPU加速支持 |
| 音频传输 | 双向语音可以控制 | 不能 | 双向语音可以控制 |
| 鼠标控制 | 客户端服务器都可以控制 | 服务器端控制 | 服务器端控制 |
| USB传输 | USB可以通过网络传输 | 不能 | USB可以通过网络传输 |
一、VNC
适用系统:windows、linux 网络流量:较小,常用100k左右 适用场景:主要用于linux的服务器的管理,由于无声音和usb传输,不满足于虚拟桌面的使用
# 安装
yum install tigervnc-server
#vnc服务器启动
vncserver
#查看连接
vncserver -list
#修改访问密码
vncpasswd
#关闭vncserver
vncserver -kill :n
配置文件修改
#配置文件修改
vim /etc/sysconfig/vncservers
# VNCSERVERS="2:myusername" sessionnumber,用户名
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
VNCSERVERS="1:root" # display port and username
VNCSERVERARGS[]="-geometry 800x600 -nolisten tcp -nohttpd"
二、SPICE
适用系统:linux 网络流量:较大,正常使用10-20M 适用场景:由于在色彩、音频和usb方面,适用于虚拟桌面,主要用于虚拟机的虚拟桌面应用 使用:安装后,需要在虚拟机中配置,参考本人关于虚拟机的blog。
三、RDP
目前在windows上 rdp有两种,remote,remotefx 适用系统:windows、linux 网络流量:较小,正常使用100-200k左右 适用场景:由于在色彩、音频、usb及本地磁盘映射方面较好,非常适用于虚拟桌面 windows 使用:系统安装后即可使用。
#linux上安装rdesktop,用于linux访问windws远程桌面
#安装
yum install rdesktop
#如需要在界面上使用需要安装
yum install tsclient
#使用命令行访问,-f 全屏 -a颜色 -c L 连接类型
rdesktop -f -a 119.0.0.100:
#使用rdp协议访问linux
yum install xrdp
#启动xrdp服务
xrdp
0x01 环境说明
- 宿主机:Windows10 + VMware Workstation 16
- 节点:控制节点controller,计算节点1、计算节点2
- 虚拟机操作系统:CentOS8.3-x86_64-Minimal2011,环境说明与准备
- OpenStack版本:Victoria
- Spice软件版本:
[root@controller ~]# yum install spice-server spice-protocol openstack-nova-spicehtml5proxy spice-html5 -y
Last metadata expiration check: 3:08:34 ago on Wed 19 May 2021 12:39:35 PM CST.
Package spice-server-0.14.3-3.el8.x86_64 is already installed.
Package spice-protocol-0.14.2-1.el8.noarch is already installed.
Package openstack-nova-spicehtml5proxy-1:22.2.1-1.el8.noarch is already installed.
Package spice-html5-0.1.1-1.fc18.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@controller ~]#
- 网络配置
| 主机名 | 管理网络 | 网卡1 | 供应商网络 | 网卡2 | 硬件配置 |
|---|---|---|---|---|---|
| controller | 10.0.0.11 | ens33 | 192.168.2.11 | ens34 | 4C8G64G |
| compute1 | 10.0.0.31 | ens33 | 192.168.2.31 | ens34 | 4C8G64G |
| compute2 | 10.0.0.32 | ens33 | 192.168.2.32 | ens34 | 4C8G64G |
0x02 OpenStack控制台SPICE协议安装配置
一、控制节点
1.安装软件
源配置
spice-html5来自epel源,spice-server,spice-protocol来自CentOS官方源
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup
yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
sed -i 's|^#baseurl=https://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
[root@controller ~]# dnf search spice
Last metadata expiration check: 0:44:37 ago on Tue May 11 10:48:46 2021.
===================================================== Name & Summary Matched: spice ======================================================
openstack-nova-spicehtml5proxy.noarch : OpenStack Nova Spice HTML5 console access service
spice-client-win-x64.noarch : Spice client MSI installers for Windows clients (64 bit)
spice-client-win-x86.noarch : Spice client MSI installers for Windows clients (32 bit)
spice-glib.i686 : A GObject for communicating with Spice servers
spice-glib.x86_64 : A GObject for communicating with Spice servers
spice-glib-devel.i686 : Development files to build Glib2 applications with spice-glib-2.0
spice-glib-devel.x86_64 : Development files to build Glib2 applications with spice-glib-2.0
spice-gtk.x86_64 : A GTK+ widget for SPICE clients
spice-gtk-tools.x86_64 : Spice-gtk tools
spice-gtk3.i686 : A GTK3 widget for SPICE clients
spice-gtk3.x86_64 : A GTK3 widget for SPICE clients
spice-gtk3-devel.i686 : Development files to build GTK3 applications with spice-gtk-3.0
spice-gtk3-devel.x86_64 : Development files to build GTK3 applications with spice-gtk-3.0
spice-gtk3-vala.x86_64 : Vala bindings for the spice-gtk-3.0 library
spice-protocol.noarch : Spice protocol header files
spice-server.i686 : Implements the server side of the SPICE protocol
spice-server.x86_64 : Implements the server side of the SPICE protocol
spice-server-devel.i686 : Header files, libraries and development documentation for spice-server
spice-server-devel.x86_64 : Header files, libraries and development documentation for spice-server
spice-streaming-agent.x86_64 : SPICE streaming agent
spice-vdagent.x86_64 : Agent for Spice guests
spice-vdagent-win-x64.noarch : Spice agent MSI installers for Windows guests (64 bit)
spice-vdagent-win-x86.noarch : Spice agent MSI installers for Windows guests (32 bit)
xorg-x11-server-Xspice.x86_64 : XSpice is an X server that can be accessed by a Spice client
========================================================== Name Matched: spice ===========================================================
spice-qxl-wddm-dod.noarch : A QXL display-only driver for Windows 10 virtual machines.
[root@controller ~]#
安装
yum makecache
yum install -y spice-server spice-protocol openstack-nova-spicehtml5proxy
手动安装spice-html5,快速下载
#yum install -y spice-html5
wget https://www.spice-space.org/download/spice-html5/spice-html5-0.1.1-1.fc18.noarch.rpm
rpm -ivh spice-html5-0.1.1-1.fc18.noarch.rpm
2.控制节点nova.conf
①
[default]指定vnc_enabled=false,否则即使配置了spice,系统也仍然使用vnc ②一定要注释掉原vnc配置
[default]
[default]
vnc_enabled=false
- 注释掉原vnc相关配置
[vnc]
#enabled = true
#server_listen = $my_ip
#server_proxyclient_address = $my_ip
[spice]
[spice]
enabled=True
keymap=en-us
server_listen=0.0.0.0
server_proxyclient_address=$my_ip
html5proxy_host=0.0.0.0
html5proxy_port=6082
html5proxy_base_url=http://10.0.0.11:6082/spice_auto.html
3.停止novncproxy并取消开机启动
systemctl stop openstack-nova-novncproxy.service
systemctl disable openstack-nova-novncproxy.service
4.启用spicehtml5proxy并配置开机自启
systemctl enable openstack-nova-spicehtml5proxy.service
systemctl start openstack-nova-spicehtml5proxy.service
环境中的防火墙相关配置详情
二、计算节点
1.安装软件
源配置
spice-html5来自epel源,spice-server,spice-protocol来自CentOS官方源
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup
yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
sed -i 's|^#baseurl=https://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
安装
yum makecache
yum install -y spice-server spice-protocol
手动安装spice-html5
#yum install -y spice-html5
wget https://www.spice-space.org/download/spice-html5/spice-html5-0.1.1-1.fc18.noarch.rpm
rpm -ivh spice-html5-0.1.1-1.fc18.noarch.rpm
2.计算节点nova.conf
①[default]指定vnc_enabled=false,否则即使配置了spice,系统也仍然使用vnc ②一定要注释掉原vnc配置
[default]
[default]
vnc_enabled=false
- 注释掉原vnc相关配置
[vnc]
#enabled = true
#server_listen = 0.0.0.0
#server_proxyclient_address = $my_ip
#novncproxy_base_url = http://192.168.2.11:6080/vnc_auto.html
[spice]
[spice]
enabled=True
keymap=en-us
server_listen=0.0.0.0
server_proxyclient_address=$my_ip
html5proxy_base_url=http://10.0.0.11:6082/spice_auto.html
3.重启nova-compute服务
systemctl restart openstack-nova-compute.service
0x04 验证SPICE安装
进入OpenStack Dashboard将实例重启
查看控制台