1.安装xrdp
sudo apt-get install xrdp
2. 安装vnc4server
sudo apt-get install vnc4server
3. 安装xubuntu-desktop
sudo apt-get install xubuntu-desktop
注意: 这一步可能会出现错误,形如:
Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: xubuntu-desktop : Depends: gtk2-engines-pixbuf but it is not going to be installed Depends: xubuntu-artwork but it is not going to be installed Depends: xubuntu-core but it is not going to be installed Depends: xubuntu-default-settings but it is not going to be installed Recommends: apt-offline but it is not going to be installed Recommends: brltty-x11 but it is not going to be installed Recommends: libreoffice-style-elementary but it is not going to be installed E: Unable to correct problems, you have held broken packages.
出现这个问题的原因是apt-get包管理器无法找到依赖项,所以无法安装依赖项的安装包。解决办法如下:
vim /etc/apt/sources.list
添加以下阿里云的源:
deb cdrom:[Ubuntu 16.04.3 LTS _Xenial Xerus_ - Release amd64 (20170801)]/ xenial main restricted deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
保存退出
然后在更新一下本地缓存
sudo apt-get update
出现该问题的原因是:
当使用apt-get安装应用时,默认配置的官网源,非常不全,导致无法自动解决依赖,而且下载的异常缓慢。所以,只需要把默认源改为正确的就可以了。这里推荐使用阿里的apt源。如果你买过阿里云的服务器,那么ubuntu系统默认也是阿里自家的apt源,非常完整而且在国内下载很快,基本在500KB/s 左右。
4.向xsession中写入xfce4-session
echo “xfce4-session” >~/.xsession
5. 开启xrdp服务
sudo service xrdp restart
6. 设置允许远程访问
进入系统-》首选项-》桌面共享,或者直接搜索桌面共享,如图所示
远程连接效果: