Skip to content

Instantly share code, notes, and snippets.

@kntjspr
Last active November 3, 2025 11:04
Show Gist options
  • Select an option

  • Save kntjspr/59bb29e15ff2f8c6bc933f198e78cba6 to your computer and use it in GitHub Desktop.

Select an option

Save kntjspr/59bb29e15ff2f8c6bc933f198e78cba6 to your computer and use it in GitHub Desktop.
Install linux essentials (Debian)
#!/bin/bash
set -e
# Change this based on your preference
printf '\ncd /mnt/c/Users/user0/Desktop\n' >> ~/.bashrc # Sets terminal on launch to navigate to that directory
echo 'alias desktop="cd /mnt/c/Users/user0/Desktop"' >> ~/.bashrc
echo 'alias py="python3"' >> ~/.bashrc # set alias py to python3
source ~/.bashrc
# ----------------------------
# Detect system specs
# ----------------------------
TOTAL_RAM_KB=$(grep MemTotal /proc/meminfo | awk '{print $2}')
TOTAL_RAM_MB=$((TOTAL_RAM_KB / 1024))
CPU_CORES=$(nproc)
echo "Detected RAM: ${TOTAL_RAM_MB}MB, CPU cores: ${CPU_CORES}"
# ----------------------------
# Dynamic swap setup
# ----------------------------
if [ "$TOTAL_RAM_MB" -lt 4096 ]; then
SWAP_SIZE_MB=$((TOTAL_RAM_MB * 2))
else
SWAP_SIZE_MB=$TOTAL_RAM_MB
fi
echo "Setting up swap: ${SWAP_SIZE_MB}MB"
if ! swapon --show | grep -q '/swapfile'; then
sudo fallocate -l ${SWAP_SIZE_MB}M /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
fi
# ----------------------------
# Dynamic ZRAM setup
# ----------------------------
if [ "$TOTAL_RAM_MB" -lt 4096 ]; then
ZRAM_SIZE_MB=$((TOTAL_RAM_MB / 2))
else
ZRAM_SIZE_MB=$((TOTAL_RAM_MB / 4))
fi
echo "Configuring zram: ${ZRAM_SIZE_MB}MB per device"
sudo apt install -y zram-tools
sudo bash -c "echo 'zram0 $ZRAM_SIZE_MB' > /etc/ztab"
sudo systemctl enable --now zramswap.service
# ----------------------------
# Disable unneeded services on low RAM
# ----------------------------
if [ "$TOTAL_RAM_MB" -lt 2048 ]; then
echo "Low RAM detected. Disabling unneeded services..."
sudo systemctl disable bluetooth.service cups.service avahi-daemon.service || true
fi
# ----------------------------
# Update system and base deps
# ----------------------------
echo "Updating system..."
sudo apt update -y && sudo apt upgrade -y
echo "Installing base dependencies (minimal)..."
sudo apt install -y --no-install-recommends \
curl \
wget \
git \
unzip \
zip \
ca-certificates \
software-properties-common \
apt-transport-https \
lsb-release \
build-essential \
htop \
tree \
whois
# ----------------------------
# Python + pip
# ----------------------------
echo "Installing Python + pip..."
sudo apt install -y python3 python3-pip python3-venv
echo "Setting alias 'py' for python3..."
if ! grep -q "alias py=" ~/.bashrc; then
echo 'alias py="python3"' >> ~/.bashrc
fi
# ----------------------------
# Node.js + npm
# ----------------------------
echo "Installing Node.js (LTS) + npm..."
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejs
sudo npm install -g npm@latest
# ----------------------------
# Go
# ----------------------------
echo "Installing Go..."
sudo apt install -y golang-go
# ----------------------------
# Docker
# ----------------------------
echo "Installing Docker..."
sudo apt install -y docker.io docker-compose
sudo systemctl enable docker
sudo usermod -aG docker $USER
# ----------------------------
# Snap
# ----------------------------
sudo apt install -y snapd
# ----------------------------
# CLI Tools
# ----------------------------
echo "Installing Neofetch..."
sudo apt install -y neofetch
echo "Installing rclone..."
curl https://rclone.org/install.sh | sudo bash
echo "Installing Deno..."
curl -fsSL https://deno.land/install.sh | sh
echo 'export DENO_INSTALL="$HOME/.deno"' >> ~/.bashrc
echo 'export PATH="$DENO_INSTALL/bin:$PATH"' >> ~/.bashrc
echo "Installing Bun..."
curl -fsSL https://bun.sh/install | bash
echo "Installing IDE..."
sudo apt-get install wget gpg -y
wget -qO- "https://windsurf-stable.codeiumdata.com/wVxQEIWkwPUEAGf3/windsurf.gpg" | gpg --dearmor > windsurf-stable.gpg
sudo install -D -o root -g root -m 644 windsurf-stable.gpg /etc/apt/keyrings/windsurf-stable.gpg
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/windsurf-stable.gpg] https://windsurf-stable.codeiumdata.com/wVxQEIWkwPUEAGf3/apt stable main" | sudo tee /etc/apt/sources.list.d/windsurf.list > /dev/null
rm -f windsurf-stable.gpg
sudo apt install apt-transport-https
sudo apt install windsurf -y
echo "Installing Poetry..."
curl -sSL https://install.python-poetry.org | python3 -
echo "Installing ngrok..."
curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null
echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list
sudo apt update -y && sudo apt install -y ngrok
# ----------------------------
# Cleanup
# ----------------------------
sudo apt autoremove -y && sudo apt clean
echo "Setup complete. Reload shell: source ~/.bashrc"
echo "Docker ready. Run: newgrp docker"
@kntjspr
Copy link
Author

kntjspr commented Nov 3, 2025

curl -fsSL https://gist.githubusercontent.com/kntjspr/59bb29e15ff2f8c6bc933f198e78cba6/raw/97b7ba3adf43afd8ea3fcd30882f69391bd6234f/install.sh -o install.sh && chmod +x install.sh && ./install.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment