NeoKylin Linux Advanced Server release V7Update6 (Chromium)

image.png

查看操作系统信息

[root@ecs-f61c-0001 ~]# nkvers
############## NeoKylin Linux Version#################
Release:
NeoKylin Linux Advanced Server release V7Update6 (Chromium)

Kernel:
4.14.0-115.5.1.el7a.06.aarch64

Build:
NeoKylin Linux Advanced Server 
release V7Update6/(Chromium)-aarch64
b06.lic/20190619

安装vncserver

以root用户运行以下命令来安装vncserver

[root@ecs-f61c-0001 sysconfig]# yum install tigervnc-server

同样运行以下命令来安装vncviewer

[root@ecs-f61c-0001 sysconfig]# yum install vnc

停止并禁用防火墙,或者开放5901,5902端口

[root@ecs-f61c-0001 sysconfig]# systemctl stop firewalld.service
[root@ecs-f61c-0001 sysconfig]# systemctl disable firewalld.service

VNC配置和应用

vncserver的配置,创建一个新的配置文件,以开启1号窗口为例(也可以同时开启多个窗口,修改数字即可),方法如下(以下命令复制了两个vncserver服务,也就是可以同时允许2个桌面启动,多个桌面以此类推):

[root@ecs-f61c-0001 sysconfig]# cp /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:1.service
[root@ecs-f61c-0001 sysconfig]# cp /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:2.service

编辑/lib/systemd/system/vncserver@:1.service,设置用户root相关参数,最终内容如下(如果有多个服务,全部需要查看一下,一般不需要修改):

# The vncserver service unit file
#
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/vncserver@.service
# 2. Replace  with the actual user name and edit vncserver
#    parameters appropriately
#    (ExecStart=/usr/sbin/runuser -l  -c "/usr/bin/vncserver %i"
#     PIDFile=/home//.vnc/%H%i.pid)
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable vncserver@:.service`
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, you should
# limit connections to the local host and then tunnel from
# the machine you want to view VNC on (host A) to the machine
# whose VNC output you want to view (host B)
#
# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
#
# this will open a connection on port 590N of your hostA to hostB's port 590M
# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
# See the ssh man page for details on port forwarding)
#
# You can then point a VNC client on hostA at vncdisplay N of localhost and with
# the help of ssh, you end up seeing what hostB makes available on port 590M
#
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
#
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.


[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking

# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l  -c "/usr/bin/vncserver %i"
PIDFile=/home//.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

[Install]
WantedBy=multi-user.target

更新systemctl以使其生效

[root@ecs-f61c-0001 sysconfig]# systemctl daemon-reload

设置vncserver的密码

[root@ecs-f61c-0001 sysconfig]# vncpasswd root
Password:
Verify:
Would you like to enter a view-only password (y/n)? y
Password:
Verify:

按提示输入密码以及确认密码

启动指定的桌面服务

[root@ecs-f61c-0001 sysconfig]# systemctl start vncserver@:1.service

或者

[root@ecs-f61c-0001 sysconfig]# vncserver :1

其他桌面类似

关闭指定的桌面服务

[root@ecs-f61c-0001 sysconfig]# systemctl stop vncserver@:1.service

或者

[root@ecs-f61c-0001 sysconfig]# vncserver -kill :1

其他桌面类似

设置为开机自动启动

[root@ecs-f61c-0001 sysconfig]# systemctl enable vncserver@:1.service
[root@ecs-f61c-0001 sysconfig]# systemctl enable vncserver@:2.service

测试VNC连接

安装VNC客户端

RealVNC官网:https://www.realvnc.com/en/connect/download/viewer/
下载地址:https://www.realvnc.com/download/file/viewer.files/VNC-Viewer-6.20.529-Windows.exe
image.png
安装客户端(略)
启动客户端:
image.png

连接服务器桌面:
image.png
输入密码连接成功:
image.png
正常登录服务器并且进行操作:
image.png

可能遇到的问题(CentOS环境下)

1.设置为非root用户报错:

[root@ecs-f61c-0001 sysconfig]# systemctl status -l vncserver@:2.service
vncserver@:2.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:2.service; enabled; vendor preset:
disabled)
Active: failed (Result: exit-code) since 一 2016-04-25 19:07:23 CST; 7s ago
Process: 10305 ExecStart=/usr/sbin/runuser -l fang -c /usr/bin/vncserver %i (code=exited,
status=1/FAILURE)
Process: 10291 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || :
(code=exited, status=0/SUCCESS)

4月 25 19:07:23 localhost.localdomain systemd[1]: Starting Remote desktop service (VNC)...
4月 25 19:07:23 localhost.localdomain systemd[1]: vncserver@:2.service: control process
exited, code=exited status=1
4月 25 19:07:23 localhost.localdomain systemd[1]: Failed to start Remote desktop service
(VNC).
4月 25 19:07:23 localhost.localdomain systemd[1]: Unit vncserver@:2.service entered failed
state.
4月 25 19:07:23 localhost.localdomain systemd[1]: vncserver@:2.service failed.

2.Type=forking报错,改为Type=simple

[root@ecs-f61c-0001 sysconfig]#  systemctl start vncserver@:2.service
Job for vncserver@:2.service failed because the control process exited with error code. See
"systemctl status vncserver@:2.service" and "journalctl -xe" for details.
[root@ecs-f61c-0001 sysconfig]#  systemctl status -l vncserver@:2.service
● vncserver@:2.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:2.service; enabled; vendor preset:
disabled)
Active: failed (Result: exit-code) since 一 2016-04-25 19:09:41 CST; 6s ago
Process: 12367 ExecStart=/usr/sbin/runuser -l root -c /usr/bin/vncserver %i (code=exited,
status=98)
Process: 12354 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || :
(code=exited, status=0/SUCCESS)

4月 25 19:09:41 localhost.localdomain systemd[1]: Starting Remote desktop service (VNC)...
4月 25 19:09:41 localhost.localdomain systemd[1]: vncserver@:2.service: control process
exited, code=exited status=98
4月 25 19:09:41 localhost.localdomain systemd[1]: Failed to start Remote desktop service
(VNC).
4月 25 19:09:41 localhost.localdomain systemd[1]: Unit vncserver@:2.service entered failed
state.
4月 25 19:09:41 localhost.localdomain systemd[1]: vncserver@:2.service failed.

3.vnc viewer客户端连接黑屏,改变xstartup的权限

这个问题是很多人容易忽视的问题,也是造成连接成功后黑屏的原因之一。
在CentOS中,xstartup的文件路径为:/root/.vnc/ (可以通过locate xstartup来查看xstartup的文件路径)
所以需要执行:

[root@ecs-f61c-0001 sysconfig]# chmod 777 /root/.vnc/xstartup

关闭防火墙

[root@ecs-f61c-0001 sysconfig]# systemctl stop firewalld.service #停止
[root@ecs-f61c-0001 sysconfig]# systemctl disable firewalld.service #禁用

推荐文章:

系统安全-启用HTTPS(腾讯云版)
2021-02-25
为增加系统和用户的安全性,平台支持启用HTTPS,使用SSL对网络流量进行证书加密传输。本篇主要介绍如何将在O2OA中启用HTTPS。
常见问题-接口代码疑惑解答汇总
2021-02-07
一、分页样例代码try(EntityManagerContaineremc=EntityManagerContainerFactory.instance().c
常见问题-如何在平台中开发Ftp文件上传文件的服务?
2021-02-07
FTP上传功能因不是平台自带功能,所以需要进行额外的java开发。当把jar包打包后,需要放入到O2目录:o2server\custom\jars。重启服务器后
信息栏目-新建信息发布流程
2021-03-01
O2OA提供的信息管理功能可以帮助用户快速地配置信息发布栏目,如通知公告,公司动态,规章制度等。用户可以高效地完成信息栏目和配置。本文主要介绍如何在O2OA中为
神经网络
2021-02-19
O2OA支持配置神经网络模型,协助完成办公系统中的信息推荐,意见选择等功能。它是一种模仿动物神经网络行为特征,进行分布式并行信息处理的算法数学模型,通过创建神经
权限管理-平台组织人员权限管理
2021-02-25
O2OA开发平台组织架构管理组件不局限于传统的组织,群组,角色,人员的关系,在减小授权管理的复杂性基础上,通过独特的职位管理,汇报关系管理思想,增强了架构管理的
系统集成-SSO与单点认证
2021-02-26
O2OA平台提供灵活的系统集成方案,让企业信息平台与各类第三方系统进行集成。本篇主要介绍如何在O2OA中与其他系统实现单点登入。
流程设计-拆分流程样例
2021-03-01
在复杂的流程设计中通常需要使用到拆分功能,比如公文管理流程中的各部门办理。本文主要介绍如何在O2OA平台中设计流程时使用流程拆分功能。
业务开发-组织架构-组织职位信息管理
2021-02-26
O2OA提供多级组织架构设置能力,用户可以在系统内设置集团、分公司、部门、小组等多级企业组织结构来满足办公需要,可以为组织设置不同的职务来实现配置和人员的解耦。
服务集成-表单界面上自定义弹出选择器功能
2021-02-07
MWF.xDesktop.requireApp("Template","Selector.Custom",null,false);//加载资源//第一个参数是选

results matching ""

    No results matching ""