ubuntu16.04利用VNC远程连接
2018-11-17 11:53:46 本文档来自oceandigit的删减简单翻译1,并带有自己的理解。
本地电脑环境Windows10,预先安装vncviewer2,远程电脑环境Ubuntu16.04,接下来对远程电脑安装vncserver。
step1–安装桌面环境和VNC Server:
默认Ubuntu系统不自带vncserver,下面安装Xfce 和TightVNC
sudo apt-get update
sudo apt install xfce4 xfce4-goodies tightvncserver
使用vncserver设置密码
vncserver
Note: vncpasswd可以对vnc重新设置密码
terminal将提示你键入和验证密码,可以不设置view-only password(这个密码将限制你修改服务器),运行vncserver命令后系统将自动生成默认配置文件。
step2–配置VNC Server
修改xstartup前先关闭vncserver并且对原配置文件做备份
vncserver -kill :1
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
vim ~/.vnc/xstartup
在配置文件中键入
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
修改权限并且运行vncserver
sudo chmod +x ~/.vnc/xstartup
vncserver
step3:使用vncviewer连接
vnc启动时默认连接的端口是5901,并且被指定为:1,因此运行xthvnc连接时,连接的端口是5900+x。在vncview中连接时键入 IP:x
解决灰屏问题:
方法1:(已经验证)
参考:https://blog.csdn.net/ypbsyy/article/details/80096757
方法2: (未验证)
参考: https://blog.csdn.net/ITLionWoo/article/details/78691667
解决Can’t find file /home/nvm/.vnc/nvmdl:1.pid You’ll have to kill the Xtightvnc process manually:
$ sudo rm -rf /tmp/*
$ sudo rm -rf /tmp/.*