# Install .NET on an Edge

This procedure will install .NET Core SDK and optionally install Visual Studio Code (VSCode) when the machine is an Ubuntu Desktop. Ubuntu Server can be promoted to Ubuntu Desktop with this procedure .NET Core SDK can be used to compile simple projects from an SSH command line or from a terminal running on the desktop. Simple editors like Vim and Nano can be used to make small code changes, but Visual Studio Code is better suited for more complex development activities. Visual Studio Code requires the Linux Desktop and will only be installed if the ~/Desktop folder exists. VS Code will also allow debugging of custom modules.

# Prerequisites

  • Valid login to Ubuntu 18.04 LTS Server or Desktop installation
  • Putty, RDP, or equivalent method to log in

# Steps

  1. Log in to the machine.

  2. Create a file called install_dotnet.sh and edit it.

  3. Paste the following contents into the file:

    #!/bin/bash
    ###########################################
    # Install .NET core always
    # install VSCode and Chrome if Desktop folder exists. 
    # change log:
    # 2020-Mar-10: Initial version
    ###########################################
    
    echo "Install .NET Core"
    
    if [ -f packages-microsoft-prod.deb ]; then
            mv -f packages-microsoft-prod.deb packages-microsoft-prod.deb.old
    fi
    wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
    sudo dpkg -i packages-microsoft-prod.deb
    
    sudo add-apt-repository universe
    sudo apt-get install apt-transport-https -y
    sudo apt-get update
    sudo apt-get install dotnet-sdk-3.1 -y
    
    echo "DONE with .NET"
    sleep 10
    if [ -d "$HOME/Desktop" ]; then
    
    curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
    sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
    sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
    
    sudo apt-get install apt-transport-https
    sudo apt-get update
    sudo apt-get install code -y # or code-insiders
    
    echo "DONE with code"
    
    echo "Adding Chrome"
    
    wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    sudo apt install ./google-chrome-stable_current_amd64.deb
    
    echo "Navigate to https://chromedriver.chromium.org/downloads to download the chrome driver"
    
    else
            echo "Skip VScode, no IDE"
    fi
    
  4. Save the file.

  5. Change the permission on the file to allow execution.

    chmod 755 install_dotnet.sh
    
  6. Run the file.

    ./install_dotnet.sh
    
  7. When completed, verify the software has been installed.

    • Determine .NET Core version:

      dotnet --version
      
  8. When using Ubuntu Desktop, perform these additional steps.

    • Start VScode:

      code
      
    • Start Google Chrome:

      google-chrome-stable
      
    • Make Chrome the default browser and verify the version.

This completes the setup for .NET Core, Visual Studio Code, and Google Chrome.

Last updated: 1/5/2022, 1:30:04 PM
Feedback