ubuntu 16.04 tightvncserver VNC 安装配置,安装xrdp,x11vnc

版权声明:本文为博主原创文章,可以自由转载。 https://blog.csdn.net/u010953692/article/details/84979965

1,ubuntu 安装 VNC

  • ubuntu系统版本
# cat /etc/issue
Ubuntu 16.04 LTS \n \l
  • tightvncserver安装
# apt-cache search tightvncserver
tightvncserver - virtual network computing server software
tightvnc-java - TightVNC java applet and command line program

# apt-get install -y tightvnserver
# apt-get install -y xfce4 xfce4-goodies

2,VNC配置

  • VNC设置密码
# vncserver 

You will require a password to access your desktops.

Password: 
  • 选择N
Would you like to enter a view-only password (y/n)? n
  • 关闭VNC服务
# ps aux | grep vnc
root     14031  0.0  0.3  14904  6448 ?        S    12月12   0:00 Xtightvnc :1
root     16565  0.0  0.2   8164  4952 ?        S    12月12   0:00 Xtightvnc :2

# vncserver -kill :1
Killing Xtightvnc process ID 14031

# vncserver -kill :2
Killing Xtightvnc process ID 16565
  • 修改VNC配置文件添加startxfce4 &
# vim .vnc/xstartup

#!/bin/sh

#/etc/X11/Xresources/x11-common
xrdb $HOME/.Xresources
startxfce4 &
  • 运行VNC
# vncserver 
New 'X' desktop is ubuntu:1

3,macOS VNC Viewer 安装

Download VNC Viewer macOS

  • VNC连接

在这里插入图片描述

  • 连接成功,但不是实时画面

在这里插入图片描述

4,安装xrdp

# apt-get install -y  xrdp

# apt-cache search vnc4server
vnc4server - Virtual network computing server software
# apt-get install -y vnc4server

# /etc/init.d/xrdp restart
[ ok ] Restarting xrdp (via systemctl): xrdp.service.

5,macOS 使用Microsoft Remote Desktop 连接ubuntu

  • Microsoft Remote Desktop百度网盘地址
链接:https://pan.baidu.com/s/1pUrgIL1i8MC1Ax2cL_1BcQ 密码:5lib

在这里插入图片描述

在这里插入图片描述

  • 连接成功 没有背景
# apt-get install -y xubuntu-desktop
# reboot

# pwd
/root
# touch .xsession
# chmod 775 .xsession
# echo xfce4-session > .xsession

# cat .xsession
xfce4-session

# vim /etc/xrdp/startwm.sh 
#!/bin/sh

if [ -r /etc/default/locale ]; then
  . /etc/default/locale
  export LANG LANGUAGE
fi

xfce4-session
. /etc/X11/Xsession

# /etc/init.d/xrdp restart
[ ok ] Restarting xrdp (via systemctl): xrdp.service.

在这里插入图片描述

6,安装teamviewer实时控制桌面

# apt-cache search teamviewer
teamviewer - Remote control and meeting solution

# apt-get install -y teamviewer 

7,x11vnc 安装,实时远程桌面

  • 安装 x11vnc
# apt-cache search x11vnc
# apt-get install -y x11vnc
# x11vnc -storepasswd

# cd /lib//systemd/system
# touch x11vnc.service
# chmod 775 x11vnc.service 
# vim /lib/systemd/system/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 /root/.vnc/passwd -rfbport 5901  -shared

[Install]
WantedBy=multi-user.target


  • 运行 x11vnc
# systemctl daemon-reload
# systemctl start x11vnc.service
# systemctl status x11vnc.service

# systemctl enable x11vnc.service
  • x11vnc 运行报错
# x11vnc
XOpenDisplay("") failed.
  • 更新软件和系统
# apt-get update && apt-get upgrade && apt-get dist-upgrade
  • 升级gnome
# apt-get install -y gnome-shell ubuntu-gnome-desktop
# gnome-shell --version
GNOME Shell 3.18.5
  • 在本机运行x11vnc,使用其它主机ssh远程访问运行x11vnc会报错
XOpenDisplay("") failed.
  • 使用vnc viewer 连接 X11vnc
# systemctl status x11vnc
● x11vnc.service - Start x11vnc at startup.
   Loaded: loaded (/lib/systemd/system/x11vnc.service; enabled; vendor preset: enabled)
   Active: active (running) since 日 2018-12-16 11:44:45 CST; 1min 28s ago
 Main PID: 5244 (x11vnc)
   CGroup: /system.slice/x11vnc.service
           ├─5244 /usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /root/.vnc/passwd -rfbport 5901 -shared
           └─5249 /usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /root/.vnc/passwd -rfbport 5901 -shared

在这里插入图片描述

# vim frpc.ini 
[x11vnc]
type = tcp
local_ip = 127.0.0.1
local_port = 5901
remote_port = 5901


  • 远程连接X11vnc ,服务器ip:5901
    在这里插入图片描述

问题:有2个画面,分辨率不对
在这里插入图片描述

参考:

  1. 如何在Ubuntu 16.04上安装和配置VNC
  2. xrdp完美实现Windows远程访问Ubuntu 16.04
  3. Ubuntu16.04安装x11VNC远程桌面

猜你喜欢

转载自blog.csdn.net/u010953692/article/details/84979965