Created
August 9, 2021 06:55
-
-
Save Layoric/527dc2a604efc8be10610fd518150ad9 to your computer and use it in GitHub Desktop.
AWS SageMaker running dotnet 5 and dotnet interactive - based on https://github.com/aws-samples/amazon-sagemaker-dotnet-image-classification
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
wget https://download.visualstudio.microsoft.com/download/pr/8468e541-a99a-4191-8470-654fa0747a9a/cb32548d2fd3d60ef3fe8fc80cd735ef/dotnet-sdk-5.0.302-linux-x64.tar.gz | |
wget https://download.visualstudio.microsoft.com/download/pr/50687c84-e120-4410-bd4a-b1e0869d03f4/6038576259f95ef61d4d103ee3967130/dotnet-runtime-5.0.8-linux-x64.tar.gz | |
mkdir -p /home/ec2-user/dotnet && tar zxf dotnet-runtime-5.0.8-linux-x64.tar.gz -C /home/ec2-user/dotnet | |
export DOTNET_ROOT=/home/ec2-user/dotnet | |
export PATH=$PATH:/home/ec2-user/dotnet | |
export DOTNET_CLI_HOME=/home/ec2-user/dotnet | |
export HOME=/home/ec2-user | |
tar zxf dotnet-sdk-5.0.302-linux-x64.tar.gz -C /home/ec2-user/dotnet | |
dotnet tool install --global Microsoft.dotnet-interactive | |
export PATH=$PATH:/home/ec2-user/dotnet/.dotnet/tools | |
dotnet interactive jupyter install | |
jupyter kernelspec list | |
touch /etc/profile.d/jupyter-env.sh | |
cat << EOF > /etc/profile.d/jupyter-env.sh | |
export PATH=\$PATH:/home/ec2-user/dotnet/.dotnet/tools:/home/ec2-user/dotnet | |
EOF | |
touch /etc/profile.d/dotnet-env.sh | |
echo "export DOTNET_ROOT=/home/ec2-user/dotnet" >> /etc/profile.d/dotnet-env.sh | |
sudo chmod -R 777 /home/ec2-user/.dotnet | |
initctl restart jupyter-server --no-wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was updated from the AWS samples but to use dotnet 5 since dotnet interactive needs it.
It also needed to correctly escape the use of
$PATH
as the values inPATH
are beforejupyter-env.sh
is run and when the on-startup.sh script is run, breaking the ability to restart the jupyter server.