Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save rcarmo/b4ce5a130e5b8de4e8d1db6b7965eedc to your computer and use it in GitHub Desktop.

Select an option

Save rcarmo/b4ce5a130e5b8de4e8d1db6b7965eedc to your computer and use it in GitHub Desktop.

Revisions

  1. rcarmo revised this gist Oct 20, 2022. 2 changed files with 135 additions and 149 deletions.
    135 changes: 135 additions & 0 deletions buid-xrdp-glamor-annotated.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,135 @@
    #!/bin/bash
    # Install Latest XRDP with XORGXRDP and GFX/Glamor server-side acceleration
    # Tested on Ubuntu 22.04 LTS

    BUILD_DIR=/tmp/xrdpbuild
    echo "-> preparing $BUILD_DIR"
    rm -f -r $BUILD_DIR
    mkdir -p $BUILD_DIR


    # Install Dependencies - Dev
    echo "-> Installing dependencies..."
    apt update
    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

    echo "-> Installing pulseaudio dependencies..."
    apt install -y libcap-dev libsndfile-dev libsndfile1-dev libspeex-dev libpulse-dev

    echo "-> Installing non-free dependencies..."
    apt install -y libfdk-aac-dev

    echo "-> Installing runtime dependencies..."
    apt install pulseaudio
    apt install xserver-xorg

    echo "-> Cloning xrdp devel tip"
    cd $BUILD_DIR
    # We go straight to git tip here, so use with caution (you can grab the latest stable tag if you prefer)
    git clone --branch devel --recursive https://github.com/neutrinolabs/xrdp.git
    cd xrdp

    echo "-> Building xrdp:"
    ./bootstrap
    # Build with glamor explicitly enabled (does not appear to make a difference for core xrdp, but I kept this anyway)
    ./configure --enable-x264 --enable-glamor --enable-rfxcodec --enable-mp3lame --enable-fdkaac --enable-opus --enable-pixman --enable-fuse --enable-jpeg --enable-ipv6
    # Control build statement (also works for me in Ubuntu 22.04, since it is xorgxrdp that actually links to glamor)
    #./configure --enable-x264 --enable-rfxcodec --enable-mp3lame --enable-fdkaac --enable-opus --enable-pixman --enable-fuse --enable-jpeg --enable-ipv6
    make -j4

    echo "-> Installing xrdp:"
    make install

    echo "-> Core xrdp done."

    echo "-> Cloning xorgxrdp from devel tip:"
    cd $BUILD_DIR
    git clone --branch devel --recursive https://github.com/neutrinolabs/xorgxrdp.git
    cd xorgxrdp

    echo "-> Building xorgxrdp:"
    ./bootstrap
    ./configure --enable-glamor
    make -j4

    echo "-> Installing xorgxrdp:"
    make install

    echo "-> xorgxrdp done."

    echo "-> Enable any user to start the X server"
    sudo sed -i 's/allowed-users=console/allowed-users=anybody/g' /etc/X11/Xwrapper.config

    echo "-> enable service..."
    systemctl enable xrdp
    systemctl stop xrdp
    systemctl start xrdp

    exit

    # -- I am NOT using the below, since I typically follow the Wiki instructions --


    echo "-> Building pulseaudio plugin"
    pulseaudio --version # Show installed version from here and use that version of pulseaudio

    cd $BUILD_DIR
    PULSEAUDIO_VERSION=$(pulseaudio --version | awk '{print $2}')
    echo "-> we have pulseaudio $PULSEAUDIO_VERSION"
    echo "-> downloading and unpacking source release..."
    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

    echo "-> building pulseaudio:"
    cd pulseaudio-$PULSEAUDIO_VERSION/
    ./configure --with-speex
    PULSEAUDIO_SRC_DIR="$PWD"

    echo "-> downloading pulseaudio-module..."
    cd $BUILD_DIR
    wget https://github.com/neutrinolabs/pulseaudio-module-xrdp/archive/v0.6.tar.gz -O pulseaudio-module-xrdp.tar.gz
    tar xvzf pulseaudio-module-xrdp.tar.gz
    rm pulseaudio-module-xrdp.tar.gz

    echo "-> building pulseaudio-module:"
    cd pulseaudio-module-xrdp*
    ./bootstrap
    ./configure PULSE_DIR=$PULSEAUDIO_SRC_DIR
    make
    make install

    ls $(pkg-config --variable=modlibexecdir libpulse)

    echo "-> cleaning up..."
    cd /tmp
    rm -f -r $BUILD_DIR

    echo "-> cleaning up pulseaudio build dependencies..."
    apt remove -y --purge libcap-dev libsndfile-dev libsndfile1-dev libspeex-dev libpulse-dev

    echo "-> cleaning up non-free build dependencies..."
    apt remove -y --purge libfdk-aac-dev

    echo "-> cleaning up main 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

    echo "-> autoremoving and clearing apt..."
    apt autoremove -y
    apt clean

    echo "-> load audio module..."
    systemctl stop xrdp
    systemctl start xrdp

    echo "-> misc. desktop fixes."
    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
    149 changes: 0 additions & 149 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,149 +0,0 @@
    THIS ARE MY NOTES OF BUILDING AN INSTALLING XORGXRDP AND XRDP WITH GPU ACCELERATION
    TESTED ON DEBIAN 9.13

    -- Build XorgXrdp with GPU acceleration ("script" - to be adjusted to your needs) : --

    ## << BUILD AND INSTALL SCRIPT START >> ##
    #!/bin/bash
    # Install Latest XRDP with XORGXRDP

    # README
    # Manual steps required first:
    # Enable "Non-Free" repost in APT by adding "non-free" at the end of every URL in /etc/apt/sources.list

    # Target Versions and Folders
    XORGXRDP_VERSION=0.2.13
    XRDP_VERSION=0.9.13
    BUILD_DIR=/tmp/xrdpbuild

    # Prepare Build Directory
    rm -f -r $BUILD_DIR
    mkdir -p $BUILD_DIR

    # Install Dependencies - Dev
    apt-get install -y 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

    # Pulse Audio Dependencies
    apt-get install -y libcap-dev libsndfile-dev libsndfile1-dev libspeex-dev libpulse-dev

    # Non Free Dependencies
    apt-get install -y libfdk-aac-dev

    # Install Dependencies - Permanent
    apt-get install pulseaudio
    apt-get install xserver-xorg

    # Build and Install XRDP
    cd $BUILD_DIR
    wget https://github.com/neutrinolabs/xrdp/releases/download/v$XRDP_VERSION/xrdp-$XRDP_VERSION.tar.gz
    tar xvzf xrdp-*.tar.gz

    rm xrdp-*.tar.gz
    cd xrdp-*

    ./bootstrap
    ./configure --enable-glamor --enable-rfxcodec --enable-mp3lame --enable-fdkaac --enable-opus --enable-pixman --enable-fuse --enable-jpeg --enable-ipv6
    make
    make install

    echo "XRDP has been installed"

    # Build and Install XORGXRDP
    cd $BUILD_DIR
    wget https://github.com/neutrinolabs/xorgxrdp/releases/download/v$XORGXRDP_VERSION/xorgxrdp-$XORGXRDP_VERSION.tar.gz
    tar xvzf xorgxrdp-*.tar.gz

    rm xorgxrdp-*.tar.gz
    cd xorgxrdp-*

    ./bootstrap
    ./configure --enable-glamor --enable-rfxcodec --enable-mp3lame --enable-fdkaac --enable-opus --enable-pixman --enable-fuse --enable-jpeg --enable-ipv6
    make
    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 # Can also be 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-get remove -y --purge libcap-dev libsndfile-dev libsndfile1-dev libspeex-dev libpulse-dev

    # Remove Non Free Dependencies
    apt-get remove -y --purge libfdk-aac-dev

    # Remove Build Dependencies
    apt-get 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

    # Script Completed
    exit


    ## << BUILD AND INSTALL SCRIPT END >> ##

    -- Extra notes: --

    # Create GPU Passtrough Nodes on Guest:

    # /etc/start/init.sh
    # crontab -e
    # @reboot /etc/start/init.sh

    #!/bin/sh
    # GPU Pass Trough
    mkdir -p /dev/dri
    mknod -m 666 /dev/dri/card0 c 226 0
    mknod -m 666 /dev/dri/renderD128 c 226 128
    mknod -m 666 /dev/fb0 c 29 0


    - Enable Non Root Login: -
    nano /etc/X11/Xwrapper.config

    # CHANGE
    allowed_users=console
    # TO
    allowed_users=anybody


    - Set specific GUI session: -
    # In Home folder of user:
    echo mate-session > ./.xsession
    echo openbox-session > ./.xsession
    echo gnome-session --session=ubuntu-2d > ./.xsession
    echo xfce4-session > ./.xsession
  2. @rkkoszewski rkkoszewski revised this gist Aug 25, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -42,7 +42,7 @@ rm xrdp-*.tar.gz
    cd xrdp-*

    ./bootstrap
    ./configure --enable-glamor
    ./configure --enable-glamor --enable-rfxcodec --enable-mp3lame --enable-fdkaac --enable-opus --enable-pixman --enable-fuse --enable-jpeg --enable-ipv6
    make
    make install

  3. @rkkoszewski rkkoszewski created this gist Aug 25, 2020.
    149 changes: 149 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,149 @@
    THIS ARE MY NOTES OF BUILDING AN INSTALLING XORGXRDP AND XRDP WITH GPU ACCELERATION
    TESTED ON DEBIAN 9.13

    -- Build XorgXrdp with GPU acceleration ("script" - to be adjusted to your needs) : --

    ## << BUILD AND INSTALL SCRIPT START >> ##
    #!/bin/bash
    # Install Latest XRDP with XORGXRDP

    # README
    # Manual steps required first:
    # Enable "Non-Free" repost in APT by adding "non-free" at the end of every URL in /etc/apt/sources.list

    # Target Versions and Folders
    XORGXRDP_VERSION=0.2.13
    XRDP_VERSION=0.9.13
    BUILD_DIR=/tmp/xrdpbuild

    # Prepare Build Directory
    rm -f -r $BUILD_DIR
    mkdir -p $BUILD_DIR

    # Install Dependencies - Dev
    apt-get install -y 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

    # Pulse Audio Dependencies
    apt-get install -y libcap-dev libsndfile-dev libsndfile1-dev libspeex-dev libpulse-dev

    # Non Free Dependencies
    apt-get install -y libfdk-aac-dev

    # Install Dependencies - Permanent
    apt-get install pulseaudio
    apt-get install xserver-xorg

    # Build and Install XRDP
    cd $BUILD_DIR
    wget https://github.com/neutrinolabs/xrdp/releases/download/v$XRDP_VERSION/xrdp-$XRDP_VERSION.tar.gz
    tar xvzf xrdp-*.tar.gz

    rm xrdp-*.tar.gz
    cd xrdp-*

    ./bootstrap
    ./configure --enable-glamor
    make
    make install

    echo "XRDP has been installed"

    # Build and Install XORGXRDP
    cd $BUILD_DIR
    wget https://github.com/neutrinolabs/xorgxrdp/releases/download/v$XORGXRDP_VERSION/xorgxrdp-$XORGXRDP_VERSION.tar.gz
    tar xvzf xorgxrdp-*.tar.gz

    rm xorgxrdp-*.tar.gz
    cd xorgxrdp-*

    ./bootstrap
    ./configure --enable-glamor --enable-rfxcodec --enable-mp3lame --enable-fdkaac --enable-opus --enable-pixman --enable-fuse --enable-jpeg --enable-ipv6
    make
    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 # Can also be 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-get remove -y --purge libcap-dev libsndfile-dev libsndfile1-dev libspeex-dev libpulse-dev

    # Remove Non Free Dependencies
    apt-get remove -y --purge libfdk-aac-dev

    # Remove Build Dependencies
    apt-get 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

    # Script Completed
    exit


    ## << BUILD AND INSTALL SCRIPT END >> ##

    -- Extra notes: --

    # Create GPU Passtrough Nodes on Guest:

    # /etc/start/init.sh
    # crontab -e
    # @reboot /etc/start/init.sh

    #!/bin/sh
    # GPU Pass Trough
    mkdir -p /dev/dri
    mknod -m 666 /dev/dri/card0 c 226 0
    mknod -m 666 /dev/dri/renderD128 c 226 128
    mknod -m 666 /dev/fb0 c 29 0


    - Enable Non Root Login: -
    nano /etc/X11/Xwrapper.config

    # CHANGE
    allowed_users=console
    # TO
    allowed_users=anybody


    - Set specific GUI session: -
    # In Home folder of user:
    echo mate-session > ./.xsession
    echo openbox-session > ./.xsession
    echo gnome-session --session=ubuntu-2d > ./.xsession
    echo xfce4-session > ./.xsession