centos vnc 黑屏?centos安装vnc

小白求教,vnc黑屏

首先连接上VNC服务器,打开控制面板,选择调整屏幕分辨率。其次点击高级设置,列出所有模式。最后选择合适的分辨率确定应用,设置完成。

无法连接至VNCServer。连接上以后出现黑屏。

)这是系统在扫描你的硬盘,可能是你自己操作的问题,如果你非法关机,直接断电或者直接按电源关电,电脑开机的时候会对你的硬件做检查,包括你的硬盘。

针对vnc这是一个linux和unix做的一个开源软件。功能的确强大。但是因为是这2个系统做的。相对于windows中多少有点不兼容。当然了情况很少发生。你说黑屏。先看看是不是你的主机电脑出问题了。如果不是。

具体描述一下吧,或者给我发短消息。有可能是X-server服务意外停止了,如果是CentOS服务器的话时间长一点X就会自动停止,这个时候VNC自然就无效了。可以尝试重启X-server。

VNC(VirtualNetworkConsole)是虚拟网络控制台的缩写。在Linux中,VNC包括以下四个命令:vncserver,vncviewer,vncpasswd,和vncconnect。大多数情况下用户只需要其中的两个命令:vncserver和vncviewer。

xshell连接Linux系统(小红帽7.3)服务器,导致服务器黑屏

一.安装

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

yum install tigervnc-server

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

yum install vnc

停止并禁用防火墙;

systemctl stop firewalld.service

systemctldisable 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=Remotedesktopservice(VNC)After=syslog.targetnetwork.target[Service]Type=forking#Cleananyexistingfilesin/tmp/.X11-unixenvironmentExecStartPre=/bin/sh-c'/usr/bin/vncserver-kill%i>/dev/null2>&1||:'ExecStart=/sbin/runuser-lroot-c"/usr/bin/vncserver%i"PIDFile=/root/.vnc/%H%i.pidExecStop=/bin/sh-c'/usr/bin/vncserver-kill%i>/dev/null2>&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号窗口;

systemctlstartvncserver@:1.service或者vncserver:1

关闭1号窗口:

systemctlstopvncserver@:1.service或者vncserver-kill:1

设置为开机自动启动;

systemctlenablevncserver@:1.service

阅读剩余
THE END