Skip to content

Instantly share code, notes, and snippets.

@mnadjit
Last active May 25, 2021 14:30
Show Gist options
  • Save mnadjit/00fa002f9728896cbd9a5ce0542caaaf to your computer and use it in GitHub Desktop.
Save mnadjit/00fa002f9728896cbd9a5ce0542caaaf to your computer and use it in GitHub Desktop.
Install required packages and applications for Raspberry Pi dev & prod environment
#!/bin/bash
# Set personal variables
echo "Git Username: "
read GIT_USER
echo "Git email: "
read GIT_EMAIL
# Set environment as development or production
echo "Environment: [prd/dev]? "
read ENVIRONMENT
#-----------------------#
# General #
#-----------------------#
# Install for all environments
sudo apt -y update
sudo apt -y full-upgrade
sudo apt -y install vim
sudo apt -y install git
# Install latest nodejs
# Add deb.nodesource.com to apt sources so version 16 gets installed (otherwise currently version 10 is considered latest)
curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
apt-get install -y nodejs
#-----------------------#
# dotnet #
#-----------------------#
# Install dotnet core 3.1.15 runtime - dependencies
sudo apt -y install libc6 libgcc1 libgssapi-krb5-2 libicu63 libssl1.1 libstdc++6 zlib1g
# Install dotnet sdk 3.1.409 OR aspnetcore 3.1.15 runtime (which contains dotnetcore runtime too)
if [[ $ENVIRONMENT == dev ]]
then
wget https://download.visualstudio.microsoft.com/download/pr/58d0ebb7-c06d-4d9a-a69f-22dac06fb278/0ae7881b7007c13a8e325d54a8f87657/dotnet-sdk-3.1.409-linux-arm.tar.gz
DOTNET_FILE=dotnet-sdk-3.1.409-linux-arm.tar.gz
else
wget https://download.visualstudio.microsoft.com/download/pr/000183b9-3d77-4e03-902e-7debe460497d/dcd6400fe1f28baba8624d3242f820a7/aspnetcore-runtime-3.1.15-linux-arm.tar.gz
DOTNET_FILE=aspnetcore-runtime-3.1.15-linux-arm.tar.gz
fi
export DOTNET_ROOT=/usr/share/dotnet
sudo mkdir -p "$DOTNET_ROOT" && sudo tar zxf "$DOTNET_FILE" -C "$DOTNET_ROOT"
sudo sh -c "echo export DOTNET_ROOT=$DOTNET_ROOT > /etc/profile.d/dotnet_init.sh"
sudo sh -c "echo export PATH='\$PATH':$DOTNET_ROOT:$DOTNET_ROOT/tools >> /etc/profile.d/dotnet_init.sh"
source /etc/profile.d/dotnet_init.sh
rm $DOTNET_FILE
# Install Entity Framework CLI
dotnet tool install --global dotnet-ef
#-----------------------#
# Docker #
#-----------------------#
# Install docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
rm get-docker.sh
# Install docker-compose
python3 -m pip install -IU docker-compose
#-----------------------#
# GitHub #
#-----------------------#
# set git config
git config --global user.name “$GIT_USER”
git config --global user.email “$GIT_EMAIL”
git config --global color.ui true
git config --global core.editor vim
# generate key pair
ssh-keygen -t rsa -b 4096 -C “$GIT_EMAIL”
# upload contents of public key file (~/.ssh/id_rsa.pub) to GitHub SSH keys
# Make sure ssh-agnet is running
eval `ssh-agent -s`
# add private key to ssh on the machine
ssh-add ~/.ssh/id_rsa
# test ssh connection to GitHub
ssh -T [email protected]
# Clone a gist from GitHub
# Git clone ssh://gist.github.com/mentus83/dd80b63538db2f42dc9af8b02ad12c07
#-----------------------#
# Clean up #
#-----------------------#
sudo apt -y update
sudo apt -y autoremove
sudo apt -y autoclean
#----------END----------#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment