以32313133353236313431303231363533e59b9ee7ad9431333365633863root用户运行以下命令来安装vncserver;

yum install tigervnc-server

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

yum install vnc

停止并禁用防火墙;

systemctl stop firewalld.service

systemctl disable firewalld.service

二.配置

vncviewer基本上不用配置;

vncserver的配置,创建一个新的配置文件,以开启1号窗口为例(也可以同时开启多个窗口,修改数字即可),方法如下:

cp /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:1.service

或者再增加一个窗口:

cp /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:2.service

编辑/lib/systemd/system/vncserver@:1.service,设置用户root相关参数,最终内容如下:

[Unit]Description=Remote desktop service (VNC)After=syslog.target network.target[Service]Type=forking# Clean any existing files in /tmp/.X11-unix environmentExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"PIDFile=/root/.vnc/%H%i.pidExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

1.设置为非root用户报错:[root@localhost system]# 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@localhost system]# 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@localhost system]# 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的文件路径)

所以需要执行:chmod 777 /root/.vnc/xstartup

关闭防火墙

systemctl stop firewalld.service #停止

systemctl disable firewalld.service #禁用

三.应用

更新systemctl以使其生效;

systemctl daemon-reload

设置vncserver的密码;

vncpasswd root

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

启动该服务用来启用vnc的1号窗口;

systemctl start vncserver@:1.service  或者 vncserver :1

关闭1号窗口:

systemctl stop vncserver@:1.service   或者 vncserver -kill :1

设置为开机自动启动;

systemctl enable vncserver@:1.service

linux服务器黑屏_xshell连接Linux系统(小红帽7.3)服务器,导致服务器黑屏相关推荐

  1. 装了oracle 开机卡黑屏,开机黑屏进不了系统,手把手教你解决电脑开机黑屏进不了系统...

    随着电脑使用的普及和使用电脑的时间越长,遇到的问题也越来越多,这不有用户却遇到了电脑开机黑屏进不了系统的情况,即现象为:开机有一声响.关机一按电源键就马上断电了,怎么解决?下面,小编就跟大家分享解决电 ...

  2. linux -------- 使用xshell ,winscp 连接linux 以及一些问题解决

    linux -------- 使用xshell ,winscp 连接linux 以及一些问题解决 参考文章: (1)linux -------- 使用xshell ,winscp 连接linux 以及 ...

  3. 电脑win7蓝屏没有修复计算机,Win7系统由于peckp.sys文件导致电脑蓝屏怎么修复

    电脑使用的时候避免不了会遇到蓝屏故障,而导致蓝屏的原因有很多种,我们可以通过提示来找到原因并解决,比如近日有win7系统用户在出现蓝屏的时候,发现是由于peckp.sys文件导致的,这个是peckp. ...

  4. Linux格式化硬盘为nvme0n1,安装ubuntu16.04系统及解决/dev/nvme0n1p7:clean...block黑屏问题...

    记录自己独立装机的过程及问题解决. (图片晚上回去再编辑,不影响阅读) 背景:我擦掉了电脑上原有的windows,选择了装为完全是ubuntu的系统,不是双系统也不是虚拟机. 双系统只需要在windo ...

  5. 怎么在Linux中telnet服务器,怎么利用Telnet连接Linux服务器

    利用Telnet连接Linux服务器需要确保:windows客户端开启telnet功能.linux服务器开启telnet服务 首先,linux服务器开启telnet服务: 许多Linux系统在默认情况 ...

  6. xshell连接linux的命令,Xshell远程连接Linux服务器xshelllinux命令大全

    Xshell 是一个强大的安全终端模拟软件,它支持SSH1, SSH2, 以及Microsoft Windows 平台的TELNET 协议.接下来是小编为大家收集的Xshell远程连接Linux服务器 ...

  7. xshell 链接linux桌面,Xshell远程桌面连接Linux系统的操作步骤

    不少伙伴只记得Windows及IOS系统,而Linux系统被遗忘了,所以不少伙伴不知道如何连接Linux系统,而下面小编就分享Xshell远程桌面连接Linux系统的操作步骤. Linux系统和Win ...

  8. linux xmanager端口,Xmanager远程连接Linux系统图形界面详解-Go语言中文社区

    1.首先安装与下载图形界面GNOME yum groupinstall "Desktop" yum groupinstall "X Window System" ...

  9. linux上mysql允许远程连接,linux下mysql允许远程连接

    1. MySql安装教程 https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html 默认情况下mysq的 roo ...

最新文章

  1. 【js】实现分页查询操作的步骤
  2. 腾讯微博即将关停,十年了,你用过吗?
  3. swift4 linux,Swift 4正式发布,新功能概览
  4. 汽车之家基于 Flink + Iceberg 的湖仓一体架构实践
  5. windows 8   远程桌面(RemoteFX )
  6. CodeForces - 225C. Barcode(DP)
  7. P3992 [BJOI2017]开车
  8. 虚拟机中Linux克隆后相关配置-1
  9. 对话富通科技CEO赵伟:企业上云潮下 MSP正步入『黄金时代』...
  10. Java 大地坐标转经纬度,经纬度与WGS84坐标转换
  11. 武汉大学计算机学院期末考试安排,【通知】关于2019-2020学年第一学期期末考试工作安排的通知...
  12. 知识图谱嵌入(KGE):方法和应用的综述
  13. 《毛泽东思想和中国特色社会主义理论体系概论》第二次在线作业
  14. java 兔子问题_Java算法之“兔子问题”
  15. IC 产品的质量与可靠性测试
  16. Conwaylife_HDLbits(康威生命游戏)
  17. 无法打开物理文件 “XXX.mdf“ 操作系统错误 5:“5(拒绝访问。)“
  18. 2011年linux数据库的android在线分享
  19. MIT-Adobe FiveK Dataset 图片自动下载
  20. 源码编译freeswitch-1.10.7遇到问题总结

热门文章

  1. tornado数据库迁移
  2. 前端生成Excel 表格
  3. 机器学习一定要很优秀才能做嘛?其实我们都可以。
  4. 浅谈数据中的偏差问题和推荐系统去偏最新研究进展
  5. ​EMNLP 2021 最新综述:语言模型中的关系性知识
  6. 向预训练进一步:掩码式非自回归模型训练
  7. 收藏!这 10 篇硬核论文,让你宅家也能更了解图神经网络
  8. 回归理性 务实推进 迎接AI新时代 2018中国人工智能大会完美收官
  9. micropython开发idethonny_ESP32 Micropython开发利器Thonny IDE介绍
  10. Java8新特性之构造器引用、方法引用