xhost: unable to open display ""

我们直截了当直截了当说出解决办法

安装tigervnc-server

在终端运行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:
xauth:  file /root/.Xauthority does not exist

New 'db.zyxasr.com:1 (root)' desktop is db.zyxasr.com: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/db.zyxasr.com:1.log

 这个时候再次执行xhost + 依然报错

在vncserver输出的结果中,我们可以看出 是在终端1上有界面显示  [db.zyxasr.com:1]

所以这是导入环境变量export DISPLAY=localhost:1

再次执行xhost +

输出access control disabled, clients can connect from any host

这样就完成了

猜你喜欢

转载自blog.csdn.net/zhangyexinaisurui/article/details/81150386