Skip to content

Commit 65d86ef

Browse files
author
Yutaro-B18016
authored
Merge pull request #2 from Yutaro-B18016:Add-ubuntu-20.04-(Work-for-18.04-too)
Add ubuntu 20.04 (Work for 18.04 too)
2 parents 2699f64 + 30581dd commit 65d86ef

1 file changed

Lines changed: 108 additions & 0 deletions

File tree

ubuntu/20.04/install.sh

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#!/bin/bash
2+
3+
#
4+
# This script is for Ubuntu 20.04 Focal Fossa to download and install XRDP+XORGXRDP via
5+
# source.
6+
#
7+
# Major thanks to: http://c-nergy.be/blog/?p=11336 for the tips.
8+
#
9+
10+
###############################################################################
11+
# Use HWE kernel packages
12+
#
13+
HWE=""
14+
#HWE="-hwe-20.04"
15+
16+
###############################################################################
17+
# Update our machine to the latest code if we need to.
18+
#
19+
20+
if [ "$(id -u)" -ne 0 ]; then
21+
echo 'This script must be run with root privileges' >&2
22+
exit 1
23+
fi
24+
25+
apt update && apt upgrade -y
26+
27+
if [ -f /var/run/reboot-required ]; then
28+
echo "A reboot is required in order to proceed with the install." >&2
29+
echo "Please reboot and re-run this script to finish the install." >&2
30+
exit 1
31+
fi
32+
33+
###############################################################################
34+
# XRDP
35+
#
36+
37+
# Install hv_kvp utils
38+
apt install -y linux-tools-virtual${HWE}
39+
apt install -y linux-cloud-tools-virtual${HWE}
40+
41+
# Install the xrdp service so we have the auto start behavior
42+
apt install -y xrdp
43+
44+
systemctl stop xrdp
45+
systemctl stop xrdp-sesman
46+
47+
# Configure the installed XRDP ini files.
48+
# use vsock transport.
49+
sed -i_orig -e 's/port=3389/port=vsock:\/\/-1:3389/g' /etc/xrdp/xrdp.ini
50+
# use rdp security.
51+
sed -i_orig -e 's/security_layer=negotiate/security_layer=rdp/g' /etc/xrdp/xrdp.ini
52+
# remove encryption validation.
53+
sed -i_orig -e 's/crypt_level=high/crypt_level=none/g' /etc/xrdp/xrdp.ini
54+
# disable bitmap compression since its local its much faster
55+
sed -i_orig -e 's/bitmap_compression=true/bitmap_compression=false/g' /etc/xrdp/xrdp.ini
56+
57+
# Add script to setup the ubuntu session properly
58+
if [ ! -e /etc/xrdp/startubuntu.sh ]; then
59+
cat >> /etc/xrdp/startubuntu.sh << EOF
60+
#!/bin/sh
61+
export GNOME_SHELL_SESSION_MODE=ubuntu
62+
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
63+
exec /etc/xrdp/startwm.sh
64+
EOF
65+
chmod a+x /etc/xrdp/startubuntu.sh
66+
fi
67+
68+
# use the script to setup the ubuntu session
69+
sed -i_orig -e 's/startwm/startubuntu/g' /etc/xrdp/sesman.ini
70+
71+
# rename the redirected drives to 'shared-drives'
72+
sed -i -e 's/FuseMountName=thinclient_drives/FuseMountName=shared-drives/g' /etc/xrdp/sesman.ini
73+
74+
# Changed the allowed_users
75+
sed -i_orig -e 's/allowed_users=console/allowed_users=anybody/g' /etc/X11/Xwrapper.config
76+
77+
# Blacklist the vmw module
78+
if [ ! -e /etc/modprobe.d/blacklist_vmw_vsock_vmci_transport.conf ]; then
79+
cat >> /etc/modprobe.d/blacklist_vmw_vsock_vmci_transport.conf <<EOF
80+
blacklist vmw_vsock_vmci_transport
81+
EOF
82+
fi
83+
84+
#Ensure hv_sock gets loaded
85+
if [ ! -e /etc/modules-load.d/hv_sock.conf ]; then
86+
echo "hv_sock" > /etc/modules-load.d/hv_sock.conf
87+
fi
88+
89+
# Configure the policy xrdp session
90+
cat > /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla <<EOF
91+
[Allow Colord all Users]
92+
Identity=unix-user:*
93+
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
94+
ResultAny=no
95+
ResultInactive=no
96+
ResultActive=yes
97+
EOF
98+
99+
# reconfigure the service
100+
systemctl daemon-reload
101+
systemctl start xrdp
102+
103+
#
104+
# End XRDP
105+
###############################################################################
106+
107+
echo "Install is complete."
108+
echo "Reboot your machine to begin using XRDP."

0 commit comments

Comments
 (0)