~johanvandegriff/zfs-server-cluster-setup

ref: 9d1ee9ae6adfe2534cb1501186523f8bb10d5b60 zfs-server-cluster-setup/ubuntu-admin-tools.sh -rw-r--r-- 1.8 KiB
9d1ee9aeJohan Vandegriff fixed typo and tested on Ubuntu 16.04 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash

#https://medium.com/@vivekteega/how-to-setup-an-xrdp-server-on-ubuntu-18-04-89f7e205bd4e
#https://community.spiceworks.com/how_to/155718-install-xrdp-on-ubuntu-18-04

. `dirname "$0"`/install-common.sh || exit 1

apt update || error "Error with apt update"
apt install -y xrdp xfce4 xfce4-whiskermenu-plugin xfwm4-themes || error "Error installing xrdp and xfce"

echo xfce4-session > /home/$SUDO_USER/.xsession || error "Error editing .xsession"

# allow just RDP through the local firewall
ufw allow 3389/tcp || error "Error allowing port 3389 for xrdp"
# restart xrdp 
/etc/init.d/xrdp restart || error "Error restarting xrdp"

apt install -y zsh tmux xclip htop glances openssh-server git gnome-disk-utility gparted gsmartcontrol pv iotop meld baobab arp-scan zenmap || error "Error installing packages"

ufw allow 22/tcp || error "Error allowing firewall port 22 for ssh"

echo y | ufw enable || error "Error enabling the firewall"

color green "oh-my-zsh will install. You will need to enter your password, then wait for it to install and quit out of the zsh shell with Ctrl-D to return to this script."
echo "Press ENTER to continue"
read a

sudo -u $SUDO_USER sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

find_zfs_pools
zfs snapshot $poolfound/ROOT/ubuntu-1@xrdp-installed || error "Error making zfs snapshot (xrdp-installed)"

color green "Importing xfce (and other) settings..."
for file in $(ls -A `dirname "$0"`/desktop-settings)
do
  path=`dirname "$0"`/desktop-settings/"$file"
  cp -var "$path" ~ || error "Error copying $file"
  chown -R $SUDO_USER:$SUDO_USER "$path"
done

zfs snapshot $poolfound/ROOT/ubuntu-1@xfce-settings || error "Error making zfs snapshot (xfce-settings)"

warning "remmina does not work to log into this setup; use KRDC instead"
color green "reboot to finish the installation"