Skip to content

Instantly share code, notes, and snippets.

@ndamulelonemakh
Last active February 7, 2024 08:56
Show Gist options
  • Select an option

  • Save ndamulelonemakh/b9e89c72369ba30f888747434b5d6f98 to your computer and use it in GitHub Desktop.

Select an option

Save ndamulelonemakh/b9e89c72369ba30f888747434b5d6f98 to your computer and use it in GitHub Desktop.
Convenience bash scripts to install various Linux CLI tools
#!/bin/bash
set -e
# Define the URL for the latest azcopy
## Tip: check latest copy from here: https://github.com/Azure/azure-storage-azcopy/releases
AZCOPY_URL="https://github.com/Azure/azure-storage-azcopy/archive/refs/tags/v10.23.0.tar.gz"
## Alternatively download straight from Azure edge
# AZCOPY_URL="https://azcopyvnext.azureedge.net/releases/release-10.20.1-20230809/azcopy_linux_amd64_10.20.1.tar.gz"
# Download the tarball
wget -O azcopy.tar.gz $AZCOPY_URL
# Remove old version
sudo mv -v /usr/local/bin/azcopy
rm -v azcopy
# Extract the tarball. --strip-components is used to 'flatten' nested directories
tar -xf azcopy.tar.gz --strip-components=1
# Move azcopy to your bin directory
sudo mv azcopy /usr/local/bin/
# Clean up
rm -v azcopy.tar.gz
echo "Azcopy has been upgraded successfully."
azcopy --version
#!/bin/bash
set -e
VERSION_ID=22.04 # 18.04, 20.04 or 22.04
wget https://packages.microsoft.com/config/ubuntu/$VERSION_ID/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update -y
sudo apt-get install libfuse3-dev fuse3 -y
sudo apt-get install blobfuse2 -y
rm -v packages-microsoft-prod.deb
#---
echo "Blob fuse install ok"
blobfuse2 --help
#!/bin/bash
set -e
# Official Guide: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
# Interactive Download Script: https://developer.nvidia.com/cuda-downloads
# Supported GPUs: https://developer.nvidia.com/cuda-gpus
# Update the system
echo "Updating system..."
sudo apt-get update -y
sudo apt-get upgrade -y
# Install dependencies
echo "Installing dependencies..."
sudo apt-get install -y build-essential dkms
# Download CUDA Toolkit
echo "Downloading CUDA Toolkit..."
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installers/cuda-repo-ubuntu2004-11-2-local_11.2.2-460.32.03-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-2-local_11.2.2-460.32.03-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-2-local/7fa2af80.pub
# Install CUDA Toolkit
echo "Installing CUDA Toolkit..."
sudo apt-get update
sudo apt-get -y install cuda
# Add CUDA to environment variables
echo "Adding CUDA to environment variables..."
echo 'export PATH=/usr/local/cuda-11.2/bin${PATH:+:${PATH}}' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-11.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc
source ~/.bashrc
# Verify CUDA installation
echo "Verifying CUDA installation..."
nvidia-smi
# Optionally install PyTorch
read -p "Do you want to install PyTorch? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "Installing PyTorch..."
sudo apt install -y python3-pip
pip3 install torch torchvision
echo "PyTorch installed successfully."
fi
echo "CUDA setup completed successfully."
#cloud-config
packages_update: true
packages_upgrade: true
runcmd:
- [ echo, "Installing docker" ]
- curl -fsSL https://get.docker.com -o get-docker.sh
- sudo sh get-docker.sh
- sudo apt-get install docker-compose-plugin
- sudo usermod -aG docker $USER
- newgrp docker
#!/bin/bash
# Summary: Install docker and docker-compose in Ubuntu
# Reference: https://docs.docker.com/engine/install/ubuntu/
# i. Install docker
sudo apt update -y
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# ii. Install docker compose from Github releases
# sudo curl -L "https://github.com/docker/compose/releases/download/2.24.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# sudo chmod +x /usr/local/bin/docker-compose
## ALTERNATIVE: Install docker compose from Ubuntu package repositories
sudo apt-get install docker-compose-plugin
docker compose version
# iii. Configure permissions - allow user to run docker commands without sudo
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
# iv. (Optional) Verify installation
docker --version
# docker login
# docker run hello-world
#!/bin/bash
set -e
# Download to an appropriate application folder e.g. /usr/local/
git clone https://github.com/flutter/flutter.git -b stable --depth 1
# Add flutter to the PATH inside ~/.bashrc
export PATH="$PATH:/usr/local/flutter/bin"
# Reload the terminal and check the installation
flutter -h
# Change ownership of the flutter installation directory
chown -R $USER"$USER /usr/local/flutter
#!/bin/bash
set -e
# Reference: https://github.com/GoogleCloudPlatform/gcsfuse/blob/master/docs/installing.md
export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s`
echo "deb https://packages.cloud.google.com/apt $GCSFUSE_REPO main" | sudo tee /etc/apt/sources.list.d/gcsfuse.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install gcsfuse
sudo apt-get update && sudo apt-get install –-only-upgrade gcsfuse
#!/bin/bash
# Install git lfs for Ubuntu
# Source: https://packagecloud.io/github/git-lfs/packages/ubuntu/bionic/git-lfs_3.2.0_amd64.deb
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs=3.2.0
#!/bin/bash
# Summary: Install jupyter lab and other common machine learning libraries in Ubuntu
sudo apt update -y
# i. Install conda
wget curl -LO https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
source ~/.bashrc
# ii. Install jupyter lab
conda install jupyterlab -c conda-forge -y
conda install -c conda-forge jupyter_http_over_ws -y # Allows accessing remote jupyter environments via ssh
# iii. Install common ML libraries
pip install pandas matplotlib tensorflow tqdm sklearn seaborn
# Other dependancies
sudo apt install make -y # Manage project using Makefiles
sudo apt install cifs-utils -y # For mounting shared drives
#!/bin/bash
set -e
sudo apt-get update -y
sudo apt install python3-venv -y
curl -sSL https://install.python-poetry.org | python3 -
# Verify
poetry --version
#!/bin/bash
set -e
# Reference: https://learn.microsoft.com/en-us/powershell/scripting/install/install-ubuntu?view=powershell-7.4#installation-via-package-repository-the-package-repository
VERSION_ID=22.04 # 18.04, 20.04 or 22.04
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo curl -o /etc/apt/sources.list.d/microsoft.list https://packages.microsoft.com/config/ubuntu/$VERSION_ID/prod.list
sudo apt-get update -y
sudo apt-get install -y powershell
# Test installation
pwsh
#!/bin/bash
# Summary: Install R in Ubuntu and make it available in jupyter lab
# Install R on ubuntu (Tested on Ubuntu 18.04)
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'
sudo apt update -y
sudo apt-get install r-base r-base-core r-recommended
# Extra requirements for compiling packages locally
sudo apt install gfortran
sudo apt-get install libblas-dev liblapack-dev
# Optional - Adding support for Jupyter lab
# Open the R interactive shell and run the following commands
# install.packages('IRkernel')
# IRkernel::installspec(user=FALSE)
#!/bin/bash
set -e
sudo add-apt-repository ppa:alex-p/tesseract-ocr-devel
sudo apt-get update -y
sudo apt-get install tesseract-ocr tesseract-ocr-eng poppler-utils -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment