This guide includes some content from the official guide "Building on Debian 8", plus some updates.
Tested on Xubuntu 16.04, fresh install. I'm using xrdp v.0.9.6 in this guide: some adaptations may be necessary for other releases. Since the official guide uses an environment variable during the build, the whole setup should be performed within a single shell console.
Install xrdp's dependencies:
sudo apt-get install git autoconf libtool pkg-config gcc g++ make libssl-dev libpam0g-dev libjpeg-dev libx11-dev libxfixes-dev libxrandr-dev flex bison libxml2-dev intltool xsltproc xutils-dev python-libxml2 g++ xutils libfuse-dev libmp3lame-dev nasm libpixman-1-dev xserver-xorg-dev-hwe-16.04
Create a directory for building:
sudo mkdir /opt/xrdp
sudo chmod 777 /opt/xrdp
cd /opt/xrdp
Get the sources for xrdp & xorgxrdp:
BD=`pwd`
mkdir -p "${BD}"/git/neutrinolabs
cd "${BD}"/git/neutrinolabs
wget https://github.com/neutrinolabs/xrdp/releases/download/v0.9.6/xrdp-0.9.6.tar.gz
wget https://github.com/neutrinolabs/xorgxrdp/releases/download/v0.2.6/xorgxrdp-0.2.6.tar.gz
Build and install xrdp server (Adapt the configure line to activate your needed features).
cd "${BD}"/git/neutrinolabs
tar xvfz xrdp-0.9.6.tar.gz
cd "${BD}"/git/neutrinolabs/xrdp-0.9.6
./bootstrap
./configure --enable-fuse --enable-mp3lame --enable-pixman
make
sudo make install
sudo ln -s /usr/local/sbin/xrdp{,-sesman} /usr/sbin
Build and install xorgxrdp:
cd "${BD}"/git/neutrinolabs
tar xvfz xorgxrdp-0.2.6.tar.gz
cd "${BD}"/git/neutrinolabs/xorgxrdp-0.2.6
./bootstrap
./configure
make
sudo make install
Open /etc/X11/Xwrapper.config
and replace allowed_users=console
with allowed_users=anybody
.
Open /etc/xrdp/sesman.ini
and change the FuseMountName
value as follows:
[Chansrv]
FuseMountName=.mounts/.thinclient_drives
Now we're going to set the keyboard layout, change it
with yours. Open /etc/xrdp/reconnectwm.sh
and add the following lines at the end:
mkdir -p ~/.mounts
if xhost > /dev/null 2>&1 ;
then
sleep 3
setxkbmap -layout it
fi
Open ~/.profile
and add the same lines:
mkdir -p ~/.mounts
if xhost > /dev/null 2>&1 ;
then
sleep 3
setxkbmap -layout it
fi
Now we're going to remove other session options, so the login screen will display Xorg as the only available choice. Run:
sudo cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bak
Now edit /etc/xrdp/xrdp.ini
and remove all connection sections, except the [Xorg]
one.
Run the following commands:
sudo systemctl enable xrdp
sudo service xrdp start
Now you should be able to connect to <<host>>:3389
with the RDP client of your choice.
Do this step if you plan to use the GUI only via RDP. After this step, the OS will take just ~90MB of RAM when no clients are connected.
sudo systemctl disable lightdm
If you need the GUI again, run the following command and restart:
sudo ln -s /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service
In order to save bandwidth, un-tick the Enable display compositing
checkbox in Settings -> Windows Manager Tweaks -> Compositor
When using Java-based GUI applications, add -Dsun.java2d.xrender=true
to JVM startup arguments in order to improve speed.