Skip to content

Instantly share code, notes, and snippets.

@shawty
Created July 28, 2022 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawty/849482b723b1253eb39da3a82e8f154f to your computer and use it in GitHub Desktop.
Save shawty/849482b723b1253eb39da3a82e8f154f to your computer and use it in GitHub Desktop.
Bash script to provision a standalone Linux container based on Debian, setting it up to run DOTNET 6 SDK and including the Midnight Commander file manager and text editor. (NOTE: Do not use this one, if you are using the 'dotnet.profile' approach, this script is ONLY for use with OS's that do not have cloud-init in the base image, if you have a …
#!/bin/bash
if [ -z "$1" ]
then
echo "Container name must be provided on first parameter"
echo "USAGE: install-dotnet.sh <containername>"
exit 1
fi
lxc file push ./install-script $1/root/install.sh
lxc exec $1 -- chmod +x install.sh
lxc exec $1 -- ./install.sh
lxc exec $1 -- rm install.sh
#!/bin/bash
# This is the ACTUAL install script that the shell script above copies to the container, then executes.
# If you need to customise the packages and build environment, do so in this file then use the shell script
# above to send it to the container and execute it.
echo Updating/Upgrading base software
sudo apt update
sudo apt upgrade -y
echo Installing Midnight Commander
sudo apt install -y mc
echo Installing .NET V6 SDK
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt update
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo apt-get install -y dotnet-sdk-6.0
sudo ln -s /usr/bin/clear /usr/bin/cls
cls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment