Skip to content

Instantly share code, notes, and snippets.

@anomixer
Forked from ElRoberto538/install_xrdp.sh
Last active June 27, 2024 03:45
Show Gist options
  • Save anomixer/0bab1436d74a9c91f7e1f7bbe6e0f750 to your computer and use it in GitHub Desktop.
Save anomixer/0bab1436d74a9c91f7e1f7bbe6e0f750 to your computer and use it in GitHub Desktop.
Notes for installing XorgXrdp and Xrdp with GLAMOR and GFX support
#!/bin/bash
# Install Latest XRDP with XORGXRDP and GFX
BUILD_DIR=/tmp/xrdpbuild
# Prepare Build Directory
rm -f -r $BUILD_DIR
mkdir -p $BUILD_DIR
# Install Dependencies - Dev
apt install -y git make autoconf libtool intltool pkg-config nasm xserver-xorg-dev libssl-dev libpam0g-dev libjpeg-dev libfuse-dev libopus-dev libmp3lame-dev libxfixes-dev libxrandr-dev libgbm-dev libepoxy-dev libegl1-mesa-dev libx264-dev
# Pulse Audio Dependencies
apt install -y libcap-dev libsndfile-dev libsndfile1-dev libspeex-dev libpulse-dev
# Non Free Dependencies
apt install -y libfdk-aac-dev
# Install Dependencies - Permanent
apt install pulseaudio
apt install xserver-xorg
# Build and Install XRDP
cd $BUILD_DIR
git clone --branch egfx --recursive https://github.com/jsorg71/xrdp.git
cd xrdp
./bootstrap
./configure --enable-x264 --enable-glamor --enable-rfxcodec --enable-mp3lame --enable-fdkaac --enable-opus --enable-pixman --enable-fuse --enable-jpeg --enable-ipv6
make -j16
make install
echo "XRDP has been installed"
# Build and Install XORGXRDP
cd $BUILD_DIR
git clone --branch egfx --recursive https://github.com/jsorg71/xorgxrdp.git
cd xorgxrdp
./bootstrap
./configure --enable-glamor
make -j16
make install
echo "XORGXRDP has been installed"
# Build and Install Pulseaudio-Sink
pulseaudio --version # Show installed version from here and use that version of pulseaudio
cd $BUILD_DIR
PULSEAUDIO_VERSION=$(pulseaudio --version | awk '{print $2}')
wget https://freedesktop.org/software/pulseaudio/releases/pulseaudio-$PULSEAUDIO_VERSION.tar.xz
tar xf pulseaudio-$PULSEAUDIO_VERSION.tar.xz
rm pulseaudio-$PULSEAUDIO_VERSION.tar.xz
cd pulseaudio-$PULSEAUDIO_VERSION/
./configure --with-speex
PULSEAUDIO_SRC_DIR="$PWD"
cd $BUILD_DIR
wget https://github.com/neutrinolabs/pulseaudio-module-xrdp/archive/v0.4.tar.gz -O pulseaudio-module-xrdp.tar.gz
tar xvzf pulseaudio-module-xrdp.tar.gz
rm pulseaudio-module-xrdp.tar.gz
cd pulseaudio-module-xrdp*
./bootstrap
./configure PULSE_DIR=$PULSEAUDIO_SRC_DIR
make
make install
ls $(pkg-config --variable=modlibexecdir libpulse)
# Cleanup
cd /tmp
rm -f -r $BUILD_DIR
# Remove Pulse Audio Dependencies
apt remove -y --purge libcap-dev libsndfile-dev libsndfile1-dev libspeex-dev libpulse-dev
# Remove Non Free Dependencies
apt remove -y --purge libfdk-aac-dev
# Remove Build Dependencies
apt remove -y --purge make autoconf libtool intltool pkg-config nasm xserver-xorg-dev libssl-dev libpam0g-dev libjpeg-dev libfuse-dev libopus-dev libmp3lame-dev libxfixes-dev libxrandr-dev libgbm-dev libepoxy-dev libegl1-mesa-dev
# Clean Residues
apt autoremove -y
apt clean
# Enable Service
systemctl enable xrdp
systemctl start xrdp
# Fix weirdness
sudo apt install gnome-tweaks -y
# Permission weirdness fix
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
EOF
# Checking if script has run already
if [ -f /etc/xrdp/startwm.sh.griffon ]
then
sudo rm /etc/xrdp/startwm.sh
sudo mv /etc/xrdp/startwm.sh.griffon /etc/xrdp/startwm.sh
fi
#Backup the file before modifying it
sudo cp /etc/xrdp/startwm.sh /etc/xrdp/startwm.sh.griffon
sudo sed -i "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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment