pwsh.sh
· 778 B · Bash
Raw
#!/bin/bash
###################################
# Prerequisites
# Update the list of packages
sudo apt-get update
# Install pre-requisite packages.
sudo apt-get install -y wget apt-transport-https software-properties-common
# Get the version of Ubuntu
source /etc/os-release
# Download the Microsoft repository keys
wget -q https://packages.microsoft.com/config/ubuntu/$VERSION_ID/packages-microsoft-prod.deb
# Register the Microsoft repository keys
sudo dpkg -i packages-microsoft-prod.deb
# Delete the Microsoft repository keys file
rm packages-microsoft-prod.deb
# Update the list of packages after we added packages.microsoft.com
sudo apt-get update
###################################
# Install PowerShell
sudo apt-get install -y powershell
# Start PowerShell
pwsh
| 1 | #!/bin/bash |
| 2 | ################################### |
| 3 | # Prerequisites |
| 4 | |
| 5 | # Update the list of packages |
| 6 | sudo apt-get update |
| 7 | |
| 8 | # Install pre-requisite packages. |
| 9 | sudo apt-get install -y wget apt-transport-https software-properties-common |
| 10 | |
| 11 | # Get the version of Ubuntu |
| 12 | source /etc/os-release |
| 13 | |
| 14 | # Download the Microsoft repository keys |
| 15 | wget -q https://packages.microsoft.com/config/ubuntu/$VERSION_ID/packages-microsoft-prod.deb |
| 16 | |
| 17 | # Register the Microsoft repository keys |
| 18 | sudo dpkg -i packages-microsoft-prod.deb |
| 19 | |
| 20 | # Delete the Microsoft repository keys file |
| 21 | rm packages-microsoft-prod.deb |
| 22 | |
| 23 | # Update the list of packages after we added packages.microsoft.com |
| 24 | sudo apt-get update |
| 25 | |
| 26 | ################################### |
| 27 | # Install PowerShell |
| 28 | sudo apt-get install -y powershell |
| 29 | |
| 30 | # Start PowerShell |
| 31 | pwsh |