1.windows端安装VNC Viewer
官网下载客户端:
Download VNC Viewer | VNC® Connect
2.Ubuntu 18.04配置
若安装的ubuntu系统不带图形界面,那么首先安装图形界面:
sudo apt-get install ubuntu-desktop
sudo reboot now
安装panel、daemon等:
sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
安装vnc:
sudo apt-get install x11vnc
安装lightdm,弹出设置中选择lightdm确认:
sudo apt-get install lightdm
创建vnc配置目录,其中“********”为VNC连接密码:
cd ~
mkdir .vnc
cd .vnc
sudo x11vnc -storepasswd ******** passwd
生成VNC配置文件:
touch x11vnc.service
打开文件,填充以下内容:
nano x11vnc.service
[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/**/.vnc/passwd -rfbport 5900 -shared
[Install]
WantedBy=multi-user.target
"ExexStart"中“**”为用户名
将配置文件移至/lib/systemd/sydtem/目录,并修改权限:
sudo mv x11vnc.service /lib/systemd/system/.
sudo chown root:root /lib/systemd/system/x11vnc.service
加载服务配置文件,查看服务开启情况:
sudo systemctl daemon-reload
sudo systemctl list-unit-files | grep x11vnc
设置开机启动VNC:
sudo systemctl enable x11vnc.service
sudo reboot now
启动后,查看监听端口:
sudo ss -tunlp
3.远程VNC连接
windows下打开客户端,File->New connection,输入ubuntu设备IP,后缀5900端口,密码为前面配置的VNC连接密码:
连接成功:
4.无显示器情况下连接
安装虚拟显示器依赖的驱动:文章来源:https://www.toymoban.com/news/detail-818292.html
sudo apt-get install xserver-xorg-core-hwe-18.04
sudo apt-get install xserver-xorg-video-dummy-hwe-18.04 --fix-missing
新增配置文件(/etc/X11/xorg.conf 或者/usr/share/X11/xorg.conf.d/xorg.conf
),填充内容:文章来源地址https://www.toymoban.com/news/detail-818292.html
sudo nano /etc/X11/xorg.conf
Section "Device"
Identifier "Configured Video Device"
Driver "dummy"
EndSection
Section "Monitor"
Identifier "Configured Monitor"
HorizSync 31.5-48.5
VertRefresh 50-70
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080"
EndSubSection
EndSection
到了这里,关于Ubuntu18.04开启VNC实现windows远程访问图形界面的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!