Skip to content

Instantly share code, notes, and snippets.

@ploegert
Last active September 15, 2025 19:04
Show Gist options
  • Save ploegert/f9b657395304821b0754f985baa124bf to your computer and use it in GitHub Desktop.
Save ploegert/f9b657395304821b0754f985baa124bf to your computer and use it in GitHub Desktop.
install_ubuntu.sh
#!/bin/bash
# Install Curl
sudo apt install curl
# Install Microsoft's public key
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /usr/share/keyrings
rm microsoft.gpg
# Install the production packages:
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/ubuntu/$(lsb_release -rs)/prod $(lsb_release -cs) main" >> /etc/apt/sources.list.d/microsoft-ubuntu-$(lsb_release -cs)-prod.list'
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/ubuntu/$(lsb_release -rs)/insiders-fast $(lsb_release -cs) main" >> /etc/apt/sources.list.d/microsoft-ubuntu-$(lsb_release -cs)-insiders-fast.list'
sudo apt update
# Install Edge's dev channel repo
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
sudo apt update
# Install Edge
sudo apt install microsoft-edge-stable
# Install Microsoft Edge - IMPORTANT! You need to install the broker first
sudo apt install microsoft-identity-broker
# Install Intune
sudo apt install intune-portal
# List installed packages & versions
sudo dpkg -l microsoft-identity-broker intune-portal microsoft-edge-stable azure-cli
# =======================================================
# Install Smart Card drivers
# Set up YubiKey
sudo apt install pcscd yubikey-manager
#Yubikey/Edge Bridge
sudo apt install opensc libnss3-tools openssl
mkdir -p $HOME/.pki/nssdb
chmod 700 $HOME/.pki
chmod 700 $HOME/.pki/nssdb
modutil -force -create -dbdir sql:$HOME/.pki/nssdb
modutil -force -dbdir sql:$HOME/.pki/nssdb -add 'SC Module' -libfile /usr/lib/x86_64-linux-gnu/pkcs11/opensc-pkcs11.so
# ===
## Note: Make sure you run chmod +x ./install_ubuntu.sh
## pw quality: password requisite pam_pwquality.so retry=3 dcredit=-1 ocredit=-1 ucredit=-1 lcredit=-1 minlen=12
echo "hello"
if ! [ $(id -u) = 0 ]; then
echo "The script need to be run as root." >&2
exit 1
fi
echo "*** Updating the system"
apt update
apt-get dist-upgrade
apt install curl
read -p "*** Adding the Microsoft package signing key to the the list of trusted keys (Press Enter To Continue)"
curl -sSl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
apt-get install wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
rm -f packages.microsoft.gpg
read -p "*** Adding microsoft package repos (Press Enter)"
curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft-ubuntu-jammy-prod.list
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
apt update
read -p "*** Installing Intune (Press Enter)"
sh -c 'echo "deb http://us.archive.ubuntu.com/ubuntu/ jammy main restricted" > /etc/apt/sources.list.d/intune_temp.jammymain.sources.list'
sh -c 'echo "deb http://us.archive.ubuntu.com/ubuntu/ jammy updates restricted" > /etc/apt/sources.list.d/intune_temp.jammyupdates.sources.list'
sh -c 'echo "deb http://security.ubuntu.com/ubuntu jammy-security main restricted" > /etc/apt/sources.list.d/intune_temp.jammysecurity.sources.list'
apt update
apt upgrade
read -p "*** Installing JDK *** (Press Enter)"
apt install openjdk-11-jre
# Point to JDK 11 until the Linux Broker is upgraded to JDK 17.
Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64"
read -p "*** Installing Intune *** (Press Enter)"
apt install intune-portal
rm /etc/apt/sources.list.d/intune_temp.*
systemctl --user daemon-reload
apt update
read -p "*** Installing VSCode *** (Press Enter)"
apt install code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment