概要:
本文介绍在天翼云主机安装DM8(达梦8)无法启动图形问题,通过vnc等工具解决该问题,并对如何解决该问题进行了总结。
先介绍下vnc工作流程:
(1) 在服务器端启动 VNC Server。
(2) VNC客户端通过浏览器或 VNC Viewer 连接至VNC Server。
(3) VNC Server传送一对话窗口至客户端,要求输入连接密码, 以及存取的VNC Server显示装置。
(4) 在客户端输入联机密码后,VNC Server验证客户端是否具有存取权限。
(5) 若是客户端通过 VNC Server 的验证,客户端即要求VNC Server显示桌面环境。
(6) VNC Server通过X Protocol 要求X Server将画面显示控制权交由VNC Server负责。
(7) VNC Server将来由 X Server 的桌面环境利用VNC通信协议送至客户端, 并且允许客户端控制VNC Server的桌面环境及输入装置。
一、安装环境和处理流程介绍
1.1安装环境介绍
本次在天翼云主机Linux系统进行DM8图形安装,操作系统版本、磁盘、内存、CPU信息如下:
[root@owumvyu4iuuzaxxp-0001 ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@owumvyu4iuuzaxxp-0001 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 2.3G 38G 6% /
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 353M 7.5G 5% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
tmpfs 1.6G 0 1.6G 0% /run/user/0
[root@owumvyu4iuuzaxxp-0001 ~]# free -h
total used free shared buff/cache available
Mem: 15G 197M 13G 353M 1.4G 14G
Swap: 0B 0B 0B
[root@owumvyu4iuuzaxxp-0001 ~]#
[root@owumvyu4iuuzaxxp-0001 ~]# cat /proc/cpuinfo |grep process
processor : 0
processor : 1
1.2简要处理流程图
该问题简要处理流程图如下:
二、详细处理流程介绍
2.1 尝试启动图形部署报错如下:
通过xshell直接启动图形报错如下:
[dmdba@owumvyu4iuuzaxxp-0001 mnt]$ ./DMInstall.bin
Extract install files.........
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-pi-gtk-3659 in java.library.path
no swt-pi-gtk in java.library.path
/tmp/swtlib-64/libswt-pi-gtk-3659.so: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
Can't load library: /tmp/swtlib-64/libswt-pi-gtk.so
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:267)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:174)
at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:22)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:132)
at com.dameng.common.gui.util.SWTUtility.<clinit>(SWTUtility.java:62)
at com.dameng.install.ui.MainApplication.run(MainApplication.java:81)
at com.dameng.install.ui.MainApplication.main(MainApplication.java:330)
[dmdba@owumvyu4iuuzaxxp-0001 mnt]$
2.2 检查linux防火墙是否关闭
[root@owumvyu4iuuzaxxp-0001 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
linux 系统防火墙已经关闭。
2.3 检查xhost是否安装
执行xhost报错如下:
[root@owumvyu4iuuzaxxp-0001 bin]# xhost+
-bash: xhost+: command not found
没有安装xhost,下面通过yum安装相关rpm包。
[root@owumvyu4iuuzaxxp-0001 bin]# yum whatprovides "*/xhost"
Loaded plugins: fastestmirror
Determining fastest mirrors
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/7): epel/x86_64/group_gz | 99 kB 00:00:00
(2/7): base/7/x86_64/group_gz | 153 kB 00:00:00
(3/7): extras/7/x86_64/primary_db | 249 kB 00:00:00
(4/7): epel/x86_64/updateinfo | 1.0 MB 00:00:06
(5/7): epel/x86_64/primary_db | 7.0 MB 00:00:17
(6/7): base/7/x86_64/primary_db | 6.1 MB 00:00:20
(7/7): updates/7/x86_64/primary_db | 21 MB 00:00:53
base/7/x86_64/filelists_db | 7.2 MB 00:00:12
epel/x86_64/filelists_db | 12 MB 00:00:19
extras/7/x86_64/filelists_db | 276 kB 00:00:00
updates/7/x86_64/filelists_db | 11 MB 00:00:18
...
[root@owumvyu4iuuzaxxp-0001 bin]# yum -y install xorg-x11-server-utils-7.7-20.el7.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package xorg-x11-server-utils.x86_64 0:7.7-20.el7 will be installed
--> Processing Dependency: libXxf86vm.so.1()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64
--> Processing Dependency: libXxf86misc.so.1()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64
--> Processing Dependency: libXt.so.6()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64
--> Processing Dependency: libXrender.so.1()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64
--> Processing Dependency: libXrandr.so.2()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64
--> Processing Dependency: libXmuu.so.1()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64
--> Processing Dependency: libXmu.so.6()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64
--> Processing Dependency: libXinerama.so.1()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64
--> Processing Dependency: libXi.so.6()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64
--> Processing Dependency: libXext.so.6()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64
--> Processing Dependency: libXcursor.so.1()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64
--> Processing Dependency: libICE.so.6()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64
--> Running transaction check
...
Verifying : libXrandr-1.5.1-2.el7.x86_64 14/18
Verifying : xorg-x11-server-utils-7.7-20.el7.x86_64 15/18
Verifying : libxcb-1.13-1.el7.x86_64 16/18
Verifying : libXt-1.1.5-3.el7.x86_64 17/18
Verifying : libX11-common-1.6.7-4.el7_9.noarch 18/18
Installed:
xorg-x11-server-utils.x86_64 0:7.7-20.el7
Dependency Installed:
libICE.x86_64 0:1.0.9-9.el7 libSM.x86_64 0:1.2.2-2.el7 libX11.x86_64 0:1.6.7-4.el7_9
libX11-common.noarch 0:1.6.7-4.el7_9 libXau.x86_64 0:1.0.8-2.1.el7 libXcursor.x86_64 0:1.1.15-1.el7
libXext.x86_64 0:1.3.3-3.el7 libXfixes.x86_64 0:5.0.3-1.el7 libXi.x86_64 0:1.7.9-1.el7
libXinerama.x86_64 0:1.1.3-2.1.el7 libXmu.x86_64 0:1.1.2-2.el7 libXrandr.x86_64 0:1.5.1-2.el7
libXrender.x86_64 0:0.9.10-1.el7 libXt.x86_64 0:1.1.5-3.el7 libXxf86misc.x86_64 0:1.0.3-7.1.el7
libXxf86vm.x86_64 0:1.1.4-1.el7 libxcb.x86_64 0:1.13-1.el7
Complete!
2.4 检查安装vncserver
检查是否安装vncserver包:
[root@owumvyu4iuuzaxxp-0001 ~]#vncserver
-bash: vncserver: command not found
安装vncserver包:
[root@owumvyu4iuuzaxxp-0001 ~]# yum whatprovides "*/vncserver"
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
tigervnc-server-1.8.0-21.el7.x86_64 : A TigerVNC server
Repo : base
Matched from:
Filename : /usr/bin/vncserver
tigervnc-server-1.8.0-22.el7.x86_64 : A TigerVNC server
Repo : updates
Matched from:
Filename : /usr/bin/vncserver
...
...
Verifying : mesa-libglapi-18.3.4-12.el7_9.x86_64 18/23
Verifying : 1:xorg-x11-xauth-1.0.9-1.el7.x86_64 19/23
Verifying : libxshmfence-1.2-1.el7.x86_64 20/23
Verifying : libXdmcp-1.1.2-6.el7.x86_64 21/23
Verifying : libXdamage-1.1.4-4.1.el7.x86_64 22/23
Verifying : libfontenc-1.1.3-3.el7.x86_64 23/23
Installed:
tigervnc-server.x86_64 0:1.8.0-21.el7
Dependency Installed:
libXdamage.x86_64 0:1.1.4-4.1.el7 libXdmcp.x86_64 0:1.1.2-6.el7
libXfont2.x86_64 0:2.0.3-1.el7 libXtst.x86_64 0:1.2.3-1.el7
libfontenc.x86_64 0:1.1.3-3.el7 libglvnd.x86_64 1:1.0.1-0.8.git5baa1e5.el7
libglvnd-glx.x86_64 1:1.0.1-0.8.git5baa1e5.el7 libjpeg-turbo.x86_64 0:1.2.90-8.el7
libxkbfile.x86_64 0:1.0.9-3.el7 libxshmfence.x86_64 0:1.2-1.el7
llvm-private.x86_64 0:7.0.1-1.el7 mesa-dri-drivers.x86_64 0:18.3.4-12.el7_9
mesa-filesystem.x86_64 0:18.3.4-12.el7_9 mesa-libGL.x86_64 0:18.3.4-12.el7_9
mesa-libglapi.x86_64 0:18.3.4-12.el7_9 pixman.x86_64 0:0.34.0-1.el7
tigervnc-license.noarch 0:1.8.0-25.el7_9 tigervnc-server-minimal.x86_64 0:1.8.0-25.el7_9
xkeyboard-config.noarch 0:2.24-1.el7 xorg-x11-xauth.x86_64 1:1.0.9-1.el7
xorg-x11-xinit.x86_64 0:1.3.4-2.el7 xorg-x11-xkb-utils.x86_64 0:7.7-14.el7
Complete!
[root@owumvyu4iuuzaxxp-0001 ~]# rpm -qa |grep vnc
gvnc-0.7.0-3.el7.x86_64
tigervnc-license-1.8.0-25.el7_9.noarch
tigervnc-server-1.8.0-25.el7_9.x86_64
tigervnc-server-module-1.8.0-25.el7_9.x86_64
gtk-vnc2-0.7.0-3.el7.x86_64
tigervnc-server-minimal-1.8.0-25.el7_9.x86_64
2.5 检查安装图形软件
经过和天翼云技术客服确认,当前使用的云主机初始化没有安装相关的图形软件,要想使用需要单独进行安装。
[root@owumvyu4iuuzaxxp-0001 ~]#yum groupinstall "X Window System"
...
[root@owumvyu4iuuzaxxp-0001 ~]#yum groupinstall "GNOME Desktop"
...
2.6 设置vnc密码
[root@owumvyu4iuuzaxxp-0001 bin]# vncserver
You will require a password to access your desktops.
Password:
Verify:
Would you like to enter a view-only password (y/n)? y
Password:
Verify:
Passwords don't match - try again
Password:
Verify:
xauth: file /root/.Xauthority does not exist
New 'owumvyu4iuuzaxxp-0001:1 (root)' desktop is owumvyu4iuuzaxxp-0001:1
Creating default startup script /root/.vnc/xstartup
Creating default config /root/.vnc/config
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/owumvyu4iuuzaxxp-0001:1.log
检查vnc服务端口,端口为5901:
[root@owumvyu4iuuzaxxp-0001 ~]# ps -ef |grep vnc
root 2017 1 0 Jun19 ? 00:00:30 /usr/bin/Xvnc :5 -auth /root/.Xauthority -desktop owumvyu4iuuzaxxp-0001:1 (root) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /root/.vnc/passwd -rfbport 5901 -rfbwait 30000
root 2032 1 0 Jun19 ? 00:00:00 /bin/sh /root/.vnc/xstartup
2.7 root用户设置DISPLAY变量
[root@owumvyu4iuuzaxxp-0001 ~]# echo $DISPLAY
owumvyu4iuuzaxxp-0004:1
如果没有请通过下面命令设置DISPALY变量:
[root@owumvyu4iuuzaxxp-0001 ~]# export DISPLAY=owumvyu4iuuzaxxp-0004:1
owumvyu4iuuzaxxp-0004:1
2.8 xhost设置允许访问
执行xhost +命令,允许客户端访问:
[root@owumvyu4iuuzaxxp-0001 ~]# xhost +
access control disabled, clients can connect from any host
2.9设置云主机访问端口规则
云主机默认没有打开vnc服务5901等访问端口,必须在云主机–弹性IP 添加入口规则,添加访问的端口范围是5901-5905。如果不设置通过vnc view 连接会报错连接超时。
如下图示意:
2.10 Windows 端安装vnc客户端vnc viewer
如下所示:
2.11.windows 端vnc viewer连接linux
如下所示:
注意在Windows vnc客户端中需按ip::5901这么写才能正常连接。成功连接设置语言后如下所示:
2.12 dmdba用户设置DISPLAY变量
[dmdba@owumvyu4iuuzaxxp-0001 ~]$ export DISPLAY=:1
[dmdba@owumvyu4iuuzaxxp-0001 ~]$ echo $DISPLAY
:1
[dmdba@owumvyu4iuuzaxxp-0001 ~]$
2.13 dmdba用户设置xhost
[dmdba@owumvyu4iuuzaxxp-0001 ~]$ xhost +
access control disabled, clients can connect from any host
2.14 启动DM8图形安装成功
在dmdba用户切换到挂载DM8安装镜像的/mnt目录下,执行如下命令:
[dmdba@owumvyu4iuuzaxxp-0001 mnt]$ ./DMInstall.bin
启动图形安装成功:
三、总结
1.云主机没有安装xhost命令,需要先安装。
xhost +命令作用:
执行xhost命令,xhost命令是X服务器的访问控制工具,用来控制哪些X客户端能够在X服务器上显示。
2.天翼云主机初始化时候没有vncserver,需要安装vncserver软件。
3.云主机安装图形软件
经过和天翼云技术客服确认,当前使用的云主机初始化没有安装相关的图形软件,要想使用需要单独进行安装。
4.设置DISPLAY变量
DISPLAY环境变量作用说明:
在Linux/Unix类操作系统GUI应用程序使用X Window系统(X Window System),它旨在允许多个用户使用窗口化的应用程序通过网络访问计算机。 DISPLAY环境变量用来设置将图形显示到何处。
5.需要在云主机–弹性ip中设置入口访问规则
通过vnc客户端连接vnc服务端,需要在云主机–弹性ip中设置入口访问规则,开发端口范围5901-5906(根据实际端口范围进行设置)。
6.root用户切换至dmdba用户需要重新设置DISPLAY变量值和xhost +命令才能在该用户下启动图形安装。
关于达梦数据库更多学习内容,欢迎访问达梦社区:
https://eco.dameng.com