当前位置:   article > 正文

Ubuntu18.04开启VNC实现windows远程访问图形界面_ubuntu远程图形界面

ubuntu远程图形界面

1.windows端安装VNC Viewer

官网下载客户端:

Download VNC Viewer | VNC® Connect

2.Ubuntu 18.04配置

若安装的ubuntu系统不带图形界面,那么首先安装图形界面:

  1. sudo apt-get install ubuntu-desktop
  2. 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连接密码:

  1. cd ~
  2. mkdir .vnc
  3. cd .vnc
  4. sudo x11vnc -storepasswd ******** passwd

生成VNC配置文件:

touch x11vnc.service

打开文件,填充以下内容:

nano x11vnc.service
  1. [Unit]
  2. Description=Start x11vnc at startup.
  3. After=multi-user.target
  4. [Service]
  5. Type=simple
  6. ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /home/**/.vnc/passwd -rfbport 5900 -shared
  7. [Install]
  8. WantedBy=multi-user.target

"ExexStart"中“**”为用户名

将配置文件移至/lib/systemd/sydtem/目录,并修改权限:

  1. sudo mv x11vnc.service /lib/systemd/system/.
  2. sudo chown root:root /lib/systemd/system/x11vnc.service

加载服务配置文件,查看服务开启情况:

  1. sudo systemctl daemon-reload
  2. sudo systemctl list-unit-files | grep x11vnc

设置开机启动VNC:

  1. sudo systemctl enable x11vnc.service
  2. sudo reboot now

启动后,查看监听端口:

sudo ss -tunlp

3.远程VNC连接

windows下打开客户端,File->New connection,输入ubuntu设备IP,后缀5900端口,密码为前面配置的VNC连接密码:

连接成功:

4.无显示器情况下连接

安装虚拟显示器依赖的驱动:

  1. sudo apt-get install xserver-xorg-core-hwe-18.04
  2. 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 ),填充内容:

sudo nano /etc/X11/xorg.conf 
  1. Section "Device"
  2. Identifier "Configured Video Device"
  3. Driver "dummy"
  4. EndSection
  5. Section "Monitor"
  6. Identifier "Configured Monitor"
  7. HorizSync 31.5-48.5
  8. VertRefresh 50-70
  9. EndSection
  10. Section "Screen"
  11. Identifier "Default Screen"
  12. Monitor "Configured Monitor"
  13. Device "Configured Video Device"
  14. DefaultDepth 24
  15. SubSection "Display"
  16. Depth 24
  17. Modes "1920x1080"
  18. EndSubSection
  19. EndSection

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/209110
推荐阅读
相关标签
  

闽ICP备14008679号