Skip to content

Instantly share code, notes, and snippets.

@valadas
Last active March 12, 2022 21:39
Show Gist options
  • Save valadas/81bb676716fc6384028b7815a220ffb1 to your computer and use it in GitHub Desktop.
Save valadas/81bb676716fc6384028b7815a220ffb1 to your computer and use it in GitHub Desktop.
Setup Ubuntu github runner for .Net

Install Ubuntu

  • Install Ubuntu 18.04 server

Setup runner

  • Follow github instructions to add a runner by going to a repository settings and creating a new self-hosted runner

Make it run on the runner

  • Edit the yml file to start a first run on it (which will probably fail due to lacking build tools)

Install .Net

  • sudo snap install dotnet-sdk --classic --channel=6.0
  • sudo snap alias dotnet-sdk.dotnet dotnet

Took these instructions from https://medium.com/@alperonline/how-to-install-dotnet-6-to-ubuntu-154a9010fa9d

Install Mono

  • sudo apt update to update the packages (again)
  • sudo apt install dirmngr gnupg apt-transport-https ca-certificates installs the necessery packages
  • sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF sets up the mono repository keys
  • sudo sh -c 'echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" > /etc/apt/sources.list.d/mono-official-stable.list' adds the mono repository to the system sources
  • sudo apt update updates the packages after we have that new repository
  • sudo apt install mono-complete actually installs mono
  • mono --version verifies the installation went fine

Took these instructions from https://linuxize.com/post/how-to-install-mono-on-ubuntu-18-04/

Install Node/Npm

  • curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - to add the repository
  • sudo apt-get install -y nodej to run the install
  • npm -v to verify it installed

Took these instructions from https://github.com/nodesource/distributions/blob/master/README.md

Notes

The actions yml files need to be updated to remove the action/cache as this is useless on a self-hosted runner as the npm/nuget packages will be cached already by the operating system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment