Skip to content

Instantly share code, notes, and snippets.

@MkDierz
Last active September 5, 2025 07:18
Show Gist options
  • Save MkDierz/445d4a34e55537f1ad1494b8089d4df8 to your computer and use it in GitHub Desktop.
Save MkDierz/445d4a34e55537f1ad1494b8089d4df8 to your computer and use it in GitHub Desktop.
#!/bin/bash
# --- Set up error handling and user feedback ---
set -e
echo "Starting software installation script... ⏳"
echo "----------------------------------------"
# --- Install essential dependencies ---
echo "βš™οΈ Checking for wget and unzip..."
sudo apt update -y
sudo apt install wget unzip -y
# --- Install GitHub CLI (gh) ---
echo "πŸš€ Installing GitHub CLI (gh)..."
if command -v gh &> /dev/null; then
echo "βœ… GitHub CLI is already installed. Skipping..."
else
sudo mkdir -p -m 755 /etc/apt/keyrings
temp_keyring=$(mktemp)
wget -nv -O "$temp_keyring" https://cli.github.com/packages/githubcli-archive-keyring.gpg
sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null < "$temp_keyring"
sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
rm "$temp_keyring"
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update -y
sudo apt install gh -y
echo "βœ… GitHub CLI installed successfully."
fi
echo "----------------------------------------"
# --- Install Nginx ---
echo "🌐 Installing Nginx..."
sudo apt install nginx -y
echo "βœ… Nginx installed successfully."
echo "----------------------------------------"
# --- Install Node Version Manager (nvm) ---
echo "πŸ“¦ Installing Node Version Manager (nvm)..."
# The curl command to install nvm should be run as the user, not root.
# Using 'bash' will execute the install script.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
# To make 'nvm' commands available in the current script, we need to source the nvm script.
# This assumes a standard shell like bash.
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Now install and use the LTS version of Node.js
echo "➑️ Installing Node.js LTS version..."
nvm install --lts
# Setting the LTS version as the default
nvm alias default 'lts/*'
echo "βœ… Node.js and npm are now installed. nvm is configured to use the LTS version."
echo "----------------------------------------"
# --- Install PM2 ---
echo "πŸ”„ Installing PM2..."
# This command must run after Node.js and npm are installed.
npm install pm2 -g
echo "βœ… PM2 installed successfully."
echo "----------------------------------------"
# --- Install uv (Python package installer) ---
echo "🐍 Installing uv..."
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "βœ… uv installed successfully."
echo "----------------------------------------"
# --- Install Bun ---
echo "πŸš€ Installing Bun..."
curl -fsSL https://bun.sh/install | bash
echo "βœ… Bun installed successfully."
echo "----------------------------------------"
---
### Load Environment Variables
echo "πŸ”„ Sourcing environment variables from ~/.local/bin/env and ~/.bashrc..."
source $HOME/.local/bin/env
source $HOME/.bashrc
echo "βœ… Environment variables loaded."
echo "πŸŽ‰ All requested software has been installed! Enjoy! πŸŽ‰"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment