windows远程桌面到Ubuntu

2023-05-16

环境:VMware + Ubuntu18.04
方案:xrdp + gnome-ubuntu(不要安装xubuntu,费力不讨好)

自己分步安装有时会遇到配置困难,建议一键安装
下载一键安装脚本:install-xrdp-3.0.sh(无需积分,可直接下载)

$ 执行:如为中文安装需要修改脚本中的部分信息,需要连接网络,或自己下载好修改脚本也可以
$ sh install-xrdp-3.0.sh

安装后可通过windows自带的 远程桌面连接 访问。
脚本内容如下:

#!/bin/bash
#####################################################################################################
# Script_Name : install-xrdp-3.0.sh
# Description : Perform a custom installation of xrdp
# on ubuntu 18.04 and later
# Date : May 2019
# written by : Griffon
# Web Site :http://www.c-nergy.be - http://www.c-nergy.be/blog
# Version : 3.0
# History : 3.0 - Added support for Ubuntu 19.04 
#               - New code for Look'n feel using xsessionrc method
#               - New code for enabling Sound Redirection - compiling from source 
#               - Removed -g parameter 
# : 2.4 - Proper fix for U18.04.2 when xserver-xorg-core-hwe-18.04
# changed code to detect whicht package in use and perform most appropriate compilation 
# : 2.3 - Quick Fix Ubuntu 18.04.2 issue when xserver-xorg-core-hwe-18.04 installed
# : 2.2 - Add Support for Ubuntu 18.10 and Yaru Theme
# : 2.1 - Add logic to enable sound redirection for U18.04
#       - re-write code logic to include functions
#       - Removed support for Ubuntu 17.10 as reached end of support
# : 2.0 - Initial Version for Ubuntu system with Gnome Desktop
# : 1.x - Script for Ubuntu 16.04 or later 
# Disclaimer : Script provided AS IS. Use it at your own risk....
####################################################################################################

#---------------------------------------------------#
# Detecting if Parameters passed to script .... 
#---------------------------------------------------#

while getopts s: option 
do 
case "${option}" 
in 
s) fixSound=${OPTARG};; 
esac 
done

#---------------------------------------------------#
# Script Version information Displayed #
#---------------------------------------------------#

echo
/bin/echo -e "\e[1;36m !-------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;36m ! Custom XRDP Installation Script - Ver 3.0                   !\e[0m"
/bin/echo -e "\e[1;36m ! Written by Griffon - May 2019 - www.c-nergy.be              !\e[0m"
/bin/echo -e "\e[1;36m !-------------------------------------------------------------!\e[0m"
echo

#--------------------------------------------------------------------------#
# -----------------------Function Section - DO NOT MODIFY -----------------#
#--------------------------------------------------------------------------#

#---------------------------------------------------#
# Function 1 - Install Prereqs...
#---------------------------------------------------#

install_prereqs() {

echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Installing PreReqs packages..Proceeding.    ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo
/bin/echo -e "\e[1;33m |-| Detecting xserver-xorg-core package installed \e[0m"

xorgver=$(dpkg-query -W -f ='${Status}\n' xserver-xorg-core | awk {'print $3'})

if [[ "$xorgver" = *not-installed* ]]; 
then
# - hwe 18.04 is installed
/bin/echo -e "\e[1;32m |-| xorg package version: xserver-xorg-core-hwe-18.04 \e[0m"
echo
sudo apt-get -y install libx11-dev libxfixes-dev libssl-dev libpam0g-dev libtool libjpeg-dev flex bison gettext autoconf libxml-parser-perl libfuse-dev xsltproc libxrandr-dev python-libxml2 nasm xserver-xorg-dev-hwe-18.04 fuse pkg-config git intltool xserver-xorg-core-hwe-18.04
else
# - hwe 18.04 not installed
/bin/echo -e "\e[1;32m |-| xorg package version: xserver-xorg-core \e[0m"
echo
sudo apt-get -y install libx11-dev libxfixes-dev libssl-dev libpam0g-dev libtool libjpeg-dev flex bison gettext autoconf libxml-parser-perl libfuse-dev xsltproc libxrandr-dev python-libxml2 nasm xserver-xorg-dev fuse pkg-config git intltool xserver-xorg-core
fi

}

#---------------------------------------------------#
# Function 2 - Download XRDP Binaries... 
#---------------------------------------------------#
get_binaries() {

echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Download xRDP Binaries.......Proceeding. ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo

cd ~/Downloads

## -- Download the xrdp latest files
echo
/bin/echo -e "\e[1;32m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;32m ! Preparing download xrdp package !\e[0m"
/bin/echo -e "\e[1;32m !---------------------------------------------!\e[0m"
echo
git clone https://github.com/neutrinolabs/xrdp.git
echo
/bin/echo -e "\e[1;32m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;32m ! Preparing download xorgxrdp package !\e[0m"
/bin/echo -e "\e[1;32m !---------------------------------------------!\e[0m"
echo
git clone https://github.com/neutrinolabs/xorgxrdp.git

}

#---------------------------------------------------#
# Function 3 - compiling xrdp... 
#---------------------------------------------------#

compile_source() {

# -- Compiling xrdp package first

echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Compile xRDP packages .......Proceeding. ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo

cd ~/Downloads/xrdp
sudo ./bootstrap
sudo ./configure --enable-fuse --enable-jpeg 
sudo make

#-- check if no error during compilation

if [ $? -eq 0 ]
then 
/bin/echo -e "\e[1;33m |-| Make Operation Completed successfully \e[0m"

else 
echo
echo
/bin/echo -e "\e[1;31m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;31m ! Error while Executing make !\e[0m"
/bin/echo -e "\e[1;31m ! The Script is exiting.... !\e[0m"
/bin/echo -e "\e[1;31m !---------------------------------------------!\e[0m"
exit
fi
sudo make install

echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Compile xorgxrdp packages....Proceeding. ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo

cd ~/Downloads/xorgxrdp 
sudo ./bootstrap 
sudo ./configure 
sudo make

# check if no error during compilation 
if [ $? -eq 0 ]
then 
echo
/bin/echo -e "\e[1;33m |-| Make Operation Completed successfully \e[0m"
echo
else 
echo
/bin/echo -e "\e[1;31m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;31m ! Error while Executing make !\e[0m"
/bin/echo -e "\e[1;31m ! The Script is exiting.... !\e[0m"
/bin/echo -e "\e[1;31m !---------------------------------------------!\e[0m"
exit
fi
sudo make install

}

#---------------------------------------------------#
# Function 5 - create services .... 
#---------------------------------------------------#

enable_service() {
echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Creating xRDP services.......Proceeding. ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo

sudo systemctl daemon-reload
sudo systemctl enable xrdp.service
sudo systemctl enable xrdp-sesman.service
sudo systemctl start xrdp

}

#---------------------------------------------------#
# Function 6 - Install Gnome Tweak Tool.... 
#---------------------------------------------------#

install_tweak() 
{
echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Installing Gnome Tweak...Proceeding... ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo
sudo apt-get install gnome-tweak-tool -y
}

#--------------------------------------------------------------------#
# Fucntion 7 - Allow console Access ....
#--------------------------------------------------------------------#

allow_console() 
{
echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Granting Console Access...Proceeding... ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo
sudo sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config
}

#---------------------------------------------------#
# Function 8 - create policies exceptions .... 
#---------------------------------------------------#

create_polkit()
{
echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Creating Polkit File...Proceeding... ! \e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo

sudo bash -c "cat >/etc/polkit-1/localauthority/50-local.d/45-allow.colord.pkla" <<EOF
[Allow Colord all Users]
Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
ResultAny=no
ResultInactive=no
ResultActive=yes

[Allow Package Management all Users]
Identity=unix-user:*
Action=org.debian.apt.*;io.snapcraft.*;org.freedesktop.packagekit.*;com.ubuntu.update-notifier.*
ResultAny=no
ResultInactive=no
ResultActive=yes
EOF

}

#---------------------------------------------------#
# Function 9 - Fixing Theme and Extensions .... 
#---------------------------------------------------#

fix_theme()
{
echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Fix Theme and extensions...Proceeding... !\e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo
sudo sed -i.bak "4 a #Improved Look n Feel Method\ncat <<EOF > ~/.xsessionrc\nexport GNOME_SHELL_SESSION_MODE=ubuntu\nexport XDG_CURRENT_DESKTOP=ubuntu:GNOME\nexport XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg\nEOF\n" /etc/xrdp/startwm.sh
echo
}

#---------------------------------------------------#
# Function 10 - Enable Sound Redirection .... 
#---------------------------------------------------#

enable_sound()
{
echo
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
/bin/echo -e "\e[1;33m ! Enabling Sound Redirection... !\e[0m"
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m"
echo

# Step 1 - Enable Source Code Repository
sudo apt-add-repository -s 'deb http://be.archive.ubuntu.com/ubuntu/ '$codename' main restricted'
sudo apt-add-repository -s 'deb http://be.archive.ubuntu.com/ubuntu/ '$codename' restricted universe main multiverse'
sudo apt-add-repository -s 'deb http://be.archive.ubuntu.com/ubuntu/ '$codename'-updates restricted universe main multiverse'
sudo apt-add-repository -s 'deb http://be.archive.ubuntu.com/ubuntu/ '$codename'-backports main restricted universe multiverse'
sudo apt-add-repository -s 'deb http://be.archive.ubuntu.com/ubuntu/ '$codename'-security main restricted universe main multiverse'
sudo apt-get update

# Step 2 - Install Some PreReqs
sudo apt-get install git libpulse-dev autoconf m4 intltool build-essential dpkg-dev -y
sudo apt build-dep pulseaudio -y

# Step 3 - Download pulseaudio source in /tmp directory - Do not forget to enable source repositories
cd /tmp
sudo apt source pulseaudio

# Step 4 - Compile
pulsever=$(pulseaudio --version | awk '{print $2}')
cd /tmp/pulseaudio-$pulsever
sudo ./configure

# step 5 - Create xrdp sound modules
sudo git clone https://github.com/neutrinolabs/pulseaudio-module-xrdp.git
cd pulseaudio-module-xrdp
sudo ./bootstrap 
sudo ./configure PULSE_DIR="/tmp/pulseaudio-$pulsever"
sudo make

#Step 6 copy files to correct location (as defined in /etc/xrdp/pulse/default.pa)
cd /tmp/pulseaudio-$pulsever/pulseaudio-module-xrdp/src/.libs
sudo install -t "/var/lib/xrdp-pulseaudio-installer" -D -m 644 *.so
sudo install -t "/usr/lib/pulse-$pulsever/modules" -D -m 644 *.so
echo

}

fix_ssl() 
{ 
echo 
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m" 
/bin/echo -e "\e[1;33m ! Fixing SSL Cert Issue ... !\e[0m" 
/bin/echo -e "\e[1;33m !---------------------------------------------!\e[0m" 
echo sudo adduser xrdp ssl-cert 
}

#--------------------------------------------------------------------------#
# -----------------------END Function Section -----------------#
#--------------------------------------------------------------------------#

#--------------------------------------------------------------------------#
#------------ MAIN SCRIPT SECTION -------------------# 
#--------------------------------------------------------------------------#

#---------------------------------------------------#
# Step 0 - Try to Detect Ubuntu Version.... 
#---------------------------------------------------#

version=$(lsb_release -sd) 
codename=$(lsb_release -sc)

echo
/bin/echo -e "\e[1;33m |-| Detecting Ubuntu version \e[0m"

if [[ "$version" = *"Ubuntu 18.04"* ]];
then
/bin/echo -e "\e[1;32m |-| Ubuntu Version : $version\e[0m"
echo
elif [[ "$version" = *"Ubuntu 18.10"* ]];
then
/bin/echo -e "\e[1;32m |-| Ubuntu Version : $version\e[0m"
echo
elif [[ "$version" = *"Ubuntu 19.04"* ]];
then
/bin/echo -e "\e[1;32m |-| Ubuntu Version : $version\e[0m"
echo
else
/bin/echo -e "\e[1;31m !------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;31m ! Your system is not running Ubuntu 18.04 Edition and later !\e[0m"
/bin/echo -e "\e[1;31m ! The script has been tested only on Ubuntu 18.04 and later !\e[0m"
/bin/echo -e "\e[1;31m ! The script is exiting... !\e[0m" 
/bin/echo -e "\e[1;31m !------------------------------------------------------------!\e[0m"
echo
exit
fi

/bin/echo -e "\e[1;33m |-| Detecting Parameters \e[0m"

#Detect if argument passed
if [ "$fixSound" = "yes" ]; 
then 
/bin/echo -e "\e[1;32m |-| Sound Redirection Option...: [YES]\e[0m"
else
/bin/echo -e "\e[1;32m |-| Sound Redirection Option...: [NO]\e[0m"
fi

#---------------------------------------------------------#
# Step 1 - Executing the installation & config tasks .... #
#---------------------------------------------------------#

echo
/bin/echo -e "\e[1;36m !-------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;36m ! Installation Process starting.... !\e[0m"
/bin/echo -e "\e[1;36m !-------------------------------------------------------------!\e[0m"
echo
/bin/echo -e "\e[1;33m |-| Proceed with installation..... \e[0m"
echo

install_prereqs
get_binaries
compile_source
enable_service
install_tweak
allow_console
create_polkit
fix_theme
fix_ssl

if [ "$fixSound" = "yes" ]; 
then 
enable_sound
fi

#---------------------------------------------------#
# Step 2 - Credits .... 
#---------------------------------------------------#
echo
/bin/echo -e "\e[1;36m !-----------------------------------------------------------------------!\e[0m"
/bin/echo -e "\e[1;36m ! Installation Completed                                                !\e[0m"
/bin/echo -e "\e[1;36m ! Please test your xRDP configuration.A Reboot Might be required...     !\e[0m"
/bin/echo -e "\e[1;36m ! Written by Griffon - April 2019 - 3.0 - Install-xrdp-3.0.sh           !\e[0m"
/bin/echo -e "\e[1;36m !-----------------------------------------------------------------------!\e[0m"
echo

参考:

xRDP – Custom Installation Script Version 3.0 (Ubuntu 18.04,18.10 & 19.04)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

windows远程桌面到Ubuntu 的相关文章

随机推荐

  • 阿里云服务器ECS入门题库

    Apsara Clouder云计算专项技能认证 xff1a 云服务器ECS入门题库 题库一多选题题库二多选题题库三多选题 保证及格 xff0c 不保证100分 xff01 xff01 xff01 保证及格 xff0c 不保证100分 xff
  • mysql 设置大小写不敏感

    一 原理与参数 mysql大小写敏感配置与两个参数相关 lower case file system 和 lower case table names 查看当前mysql的大小写敏感配置 show global variables like
  • mysql字符集查看与设置

    一 查看 MySQL 字符集 以下命令 Windows amp Linux通用 1 服务器和数据库 mysql gt show variables like 39 char 39 43 43 43 Variable name Value 4
  • WindTerm使用(暂停更新)

    作为一个经常和代码以及服务器打交道的人 xff0c 连接远程服务器所使用的工具肯定是越方便越好 目前 xff0c 我使用的是xshell5和MobaXterm两个 Xshell最新的是7 xff0c 破解版的我懒得去找 xff0c 那xsh
  • 彻底解决[未识别的网络][公共网络]的问题

    未识别的网络 导致网络变成 未知网络 或 公共网络 会造成一系列问题 比如防火墙的一些端口会挡在公共之外 等等 不细说 那么要如何把 未知网络 公用网络 怎么改变为 家庭 和 工作网络 网络的回答比如 百度问题上的回答都是无脑的回答 不可能
  • centos7安装Docker详细步骤(无坑版教程)

    一 安装前必读 在安装 Docker 之前 xff0c 先说一下配置 xff0c 我这里是Centos7 Linux 内核 xff1a 官方建议 3 10 以上 xff0c 3 8以上貌似也可 注意 xff1a 本文的命令使用的是 root
  • windows通过xrdp实现远程ubuntu

    首先声明 xff1a 我使用的是root用户 xff0c 所以无视权限问题 第一步 安装vncserver wget http www c nergy be downloads tigervncserver 1 6 80 4 amd64 z
  • 【Vue2+Vue3】开发指令使用总结,未完待续

    目录 一 watch监听及深度监听 二 directive自定义指令详解 43 实例 三 1 vue父子组件 xff1a 数据双向绑定 一 数据双向绑定 sync xff08 支持多个双向绑定值 xff09 三 2 父子组件间方法的调用 1
  • 南京大学数字电路与计算机组成实验的Verilator仿真(二)

    实验二 1 2 4译码器 top v module span class token function decode24 span span class token punctuation span x span class token p
  • firefox 的cookie 存放在哪里?

    在地址栏输入about surpport 打开配置页 找到about profiles 点击打开 看到有两个目录项 看准正在使用的那一个 34 正在使用此配置文件 34 找到cookie sqlite 的位置 正在使用的那个配置是删不掉的
  • C++ 构造函数和New运算符

    算法和数据结构就是编程的一个重要部分 xff0c 你若失掉了算法和数据结构 xff0c 你就把一切都失掉了 系统会自动在栈中为每个变量开辟内存空间 xff0c 以保证数值被合理地存放 由于栈是系统自动分配的 xff0c 因此速度较快 xff
  • matlab函数interp2及其c++代码

    最近将一个matlab程序转为c 途中遇到interp2这个家伙 我是左查右查 发现网上没有人总结这个玩意 于是我来初探一下 还是别有洞天的 嘿嘿 1 关于interp2 nbsp nbsp Vq interp2 X Y V Xq Yq l
  • CentOS 7中利用Snapper快照进行系统备份与恢复

    为什么要使用Snapper快照 xff1f 我们可以想像以下场景 xff1a 1 场景一 xff1a 系统发生意外宕机 xff0c 工程师无法快速定位问题 xff0c 业务受到中断 xff0c 客户十分不满意 2 场景二 xff1a 项目会
  • 计蒜之道 作弊揭发者(测试赛)

    鉴于我市拥堵的交通状况 xff0c 市政交管部门经过听证决定在道路两侧安置自动停车收费系统 当车辆驶入车位 xff0c 系统会通过配有的摄像头拍摄车辆画面 xff0c 通过识别车牌上的数字 字母序列识别车牌 xff0c 通过连接车管所车辆信
  • 7-10 兔子繁衍问题

    7 10 兔子繁衍问题 xff08 15 分 xff09 一对兔子 xff0c 从出生后第3个月起每个月都生一对兔子 小兔子长到第3个月后每个月又生一对兔子 假如兔子都不死 xff0c 请问第1个月出生的一对兔子 xff0c 至少需要繁衍到
  • Ubuntu运行tkinter程序的部署

    软件部署 xff08 Ubuntu系统 xff09 1 安装python环境 前提需要有网 ubuntu会自带python xff0c 不用单独安装 xff0c 但python的pip工具和tkinter包需要安装 xff08 1 xff0
  • Linux-用shell脚本写一个进度条

    shell执行脚本 xff1a 创建一个 sh文件 xff0c 编辑文件即可执行脚本 Shell脚本中用 表示注释 xff0c 相当于c语言的 注释 但如果 位于第一行开头 xff0c 并且是则例外 xff0c 它表示该脚本使用后面指定的解
  • S3C2440裸机按键控制小灯

    1 环境 1 操作系统 xff1a win7 64位 2 集成开发环境 xff1a keil4 7 3 开发板 xff1a FL2440 4 下载器 xff1a Jlink V9 2 按键以及LED灯原理图 根据FL2440开发板原理图可知
  • 数组存邻接表

    模板 xff1a 数组表示邻接表 int top 61 0 向 点中存第top个边 int head MAX N 61 1 每个点在建立邻接表时 xff0c 栈顶的边的编号 边的结构体 struct Edge int v 另一端连接的点 i
  • windows远程桌面到Ubuntu

    环境 xff1a VMware 43 Ubuntu18 04 方案 xff1a xrdp 43 gnome ubuntu xff08 不要安装xubuntu xff0c 费力不讨好 xff09 自己分步安装有时会遇到配置困难 xff0c 建