Posted on
Artificial Intelligence

Artificial Intelligence Linux Checklists

Author
  • User
    linuxbash
    Posts by this author
    Posts by this author

Artificial Intelligence Linux Checklists: A Bash-First Guide You Can Reuse

Ever lost an evening to “CUDA not found” or “Torch can’t see your GPU” after a fresh Linux install? The fastest way to prevent that pain is a repeatable checklist you can paste into your terminal. This post gives you a Bash-friendly, vendor-agnostic set of AI checklists you can adapt, automate, and share with your team.

What you’ll get:

  • Why a checklist beats ad‑hoc setup every time

  • 3–5 actionable, copy/pasteable steps to get AI-ready on Linux (CPU-first, GPU optional)

  • Package install commands for apt, dnf, and zypper wherever we cite them

  • Real-world verification snippets you can add to CI or provisioning scripts

Why an “AI Linux Checklist” is worth it

  • Reproducibility: Step-by-step installs reduce “works on my machine” issues.

  • Speed: Onboarding a new laptop, VM, or cloud node becomes a 20–30 minute routine.

  • Stability: Properly versioned Python envs and BLAS backends cut runtime surprises.

  • Scriptability: Every line below can live in a bootstrap.sh and be rerun safely.


1) Baseline System Sanity (10 minutes)

Install build tools, Python, and math libs. These are universal prerequisites that make 90% of AI Python packages just work.

Apt (Ubuntu/Debian):

sudo apt update && sudo apt -y upgrade
sudo apt install -y build-essential gcc g++ make pkg-config cmake ninja-build \
  git curl wget unzip \
  python3 python3-venv python3-pip python3-dev \
  libopenblas-dev htop nvtop

Dnf (Fedora/RHEL/CentOS Stream):

sudo dnf -y upgrade
sudo dnf groupinstall -y "Development Tools"
sudo dnf install -y gcc-c++ make pkgconf-pkg-config cmake ninja-build \
  git curl wget unzip \
  python3 python3-pip python3-devel \
  openblas-devel htop nvtop

Zypper (openSUSE Leap/Tumbleweed):

sudo zypper refresh && sudo zypper -y update
sudo zypper install -y -t pattern devel_basis
sudo zypper install -y cmake ninja git curl wget unzip pkg-config \
  python3 python3-pip python3-devel python3-virtualenv \
  openblas-devel htop nvtop

Quick checks:

gcc --version
python3 -V
python3 -c "import sys,sysconfig; print('venv OK' if 'venv' in sys.builtin_module_names else 'venv module available')"
ldconfig -p | grep -i blas || echo "OpenBLAS not on linker path? (usually fine)"

Pro tip: Create a workspace and keep it non-root.

mkdir -p ~/ai && cd ~/ai

2) Clean Python Environments (5–10 minutes)

Use venv so experiments don’t step on system packages.

Create and activate a project env:

python3 -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip wheel setuptools

Install a minimal, CPU-first AI stack (works everywhere immediately; add GPU later):

pip install "numpy<2" scipy pandas scikit-learn jupyterlab onnxruntime xgboost
# PyTorch CPU-only (fast to verify)
pip install --index-url https://download.pytorch.org/whl/cpu torch torchvision torchaudio
# TensorFlow CPU-only
pip install tensorflow-cpu

Smoke test:

python - <<'PY'
import numpy as np, torch
a = torch.randn(1000,1000) @ torch.randn(1000,1000)
print("Torch OK | device:", "cuda" if torch.cuda.is_available() else "cpu")
print("NumPy:", np.__version__)
PY

Freeze for reproducibility:

pip freeze > requirements.txt

3) Optional GPU Stack Validation (NVIDIA/AMD/Intel)

Start by detecting what you have:

lspci | egrep -i 'nvidia|amd|advanced micro devices|intel'

If you’re using NVIDIA, this is the most common friction point. The safest path is: install the correct driver, reboot, then add CUDA as needed.

NVIDIA on Ubuntu (apt):

# Ubuntu only: install recommended proprietary driver
sudo apt update
sudo apt install -y ubuntu-drivers-common
ubuntu-drivers devices
sudo ubuntu-drivers autoinstall
sudo reboot
# (optional) CUDA toolkit from Ubuntu repo (not always newest)
sudo apt install -y nvidia-cuda-toolkit

NVIDIA on Fedora (dnf, via RPM Fusion):

# Enable RPM Fusion (required for NVIDIA driver)
sudo dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
                     https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
# Install driver and CUDA userspace libraries
sudo dnf install -y akmod-nvidia xorg-x11-drv-nvidia-cuda
sudo reboot

NVIDIA on openSUSE (zypper):

# Add NVIDIA repo (choose one: Tumbleweed or Leap)
# Tumbleweed:
sudo zypper addrepo --refresh https://download.nvidia.com/opensuse/tumbleweed/ nvidia
# Leap (replace 15.6 with your Leap release):
# sudo zypper addrepo --refresh https://download.nvidia.com/opensuse/leap/15.6/ nvidia
sudo zypper refresh
# Install driver (G06 = newer GPUs; use G05 for older)
sudo zypper install -y nvidia-driver-G06
sudo reboot

Verify NVIDIA stack:

nvidia-smi
nvcc --version || echo "CUDA compiler not installed (OK if you only need runtime)"
python - <<'PY'
import torch
print("Torch sees CUDA:", torch.cuda.is_available())
print("CUDA devices:", torch.cuda.device_count())
PY

AMD ROCm or Intel OpenCL?

  • Validation commands:
# AMD
which rocm-smi && rocm-smi || echo "Install ROCm to use rocm-smi"
which hipcc && hipcc --version || echo "HIP/ROCm not present"
# Intel / generic OpenCL check
clinfo || echo "Install clinfo to query OpenCL platforms"

Install clinfo:

  • apt: sudo apt install -y clinfo

  • dnf: sudo dnf install -y clinfo

  • zypper: sudo zypper install -y clinfo

Notes:

  • Secure Boot may block third-party kernel modules (NVIDIA). Disable or enroll MOK.

  • Match CUDA/driver versions recommended by your framework (e.g., specific PyTorch builds).

  • If you’re starting out, validate with CPU first; add GPU when stable.


4) Containers for Reproducible AI

If you prefer to isolate everything with containers, install Docker or Podman.

Docker Engine:

  • apt:
sudo apt update
sudo apt install -y docker.io
sudo systemctl enable --now docker
sudo usermod -aG docker $USER
newgrp docker
docker run --rm hello-world
  • dnf (Fedora):
sudo dnf install -y moby-engine docker-compose-plugin
sudo systemctl enable --now docker
sudo usermod -aG docker $USER
newgrp docker
docker run --rm hello-world
  • zypper (openSUSE):
sudo zypper install -y docker docker-compose
sudo systemctl enable --now docker
sudo usermod -aG docker $USER
newgrp docker
docker run --rm hello-world

Podman (rootless by default):

  • apt: sudo apt install -y podman

  • dnf: sudo dnf install -y podman

  • zypper: sudo zypper install -y podman

Tip: For GPU passthrough, use official vendor guides (NVIDIA Container Toolkit, ROCm containers) after your driver stack is working.


5) Performance and Monitoring Quick Wins

Threading hints for BLAS and ML libs (tweak to taste):

# Put these in ~/.bashrc or per-project .env
export OMP_NUM_THREADS=$(nproc)
export OPENBLAS_NUM_THREADS=$(nproc)
export MKL_NUM_THREADS=$(nproc)
# TensorFlow knobs (optional)
export TF_NUM_INTRAOP_THREADS=$(nproc)
export TF_NUM_INTEROP_THREADS=2

Live monitors:

htop
nvtop        # NVIDIA and select AMD support; use with watch -n 1 nvtop if needed
watch -n 1 nvidia-smi

Benchmark sanity:

python - <<'PY'
import time, torch
device = 'cuda' if torch.cuda.is_available() else 'cpu'
x = torch.randn(8192,8192, device=device)
t = time.time(); y = x @ x; torch.cuda.synchronize() if device=='cuda' else None
print(device, "GEMM ms:", (time.time()-t)*1e3)
PY

Real-World: One-Command Bootstrap Script

Drop this into bootstrap.sh and run on a fresh VM to get a ready-to-use CPU-only AI box with Jupyter.

#!/usr/bin/env bash
set -euo pipefail

PKG=""
if command -v apt >/dev/null 2>&1; then PKG="apt"
elif command -v dnf >/dev/null 2>&1; then PKG="dnf"
elif command -v zypper >/dev/null 2>&1; then PKG="zypper"
else echo "Unsupported package manager"; exit 1; fi

case "$PKG" in
  apt)
    sudo apt update && sudo apt -y upgrade
    sudo apt install -y build-essential gcc g++ make pkg-config cmake ninja-build \
      git curl wget unzip python3 python3-venv python3-pip python3-dev libopenblas-dev \
      htop nvtop
    ;;
  dnf)
    sudo dnf -y upgrade
    sudo dnf groupinstall -y "Development Tools"
    sudo dnf install -y gcc-c++ make pkgconf-pkg-config cmake ninja-build \
      git curl wget unzip python3 python3-pip python3-devel openblas-devel \
      htop nvtop
    ;;
  zypper)
    sudo zypper refresh && sudo zypper -y update
    sudo zypper install -y -t pattern devel_basis
    sudo zypper install -y cmake ninja git curl wget unzip pkg-config \
      python3 python3-pip python3-devel python3-virtualenv openblas-devel \
      htop nvtop
    ;;
esac

mkdir -p ~/ai && cd ~/ai
python3 -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip wheel setuptools
pip install "numpy<2" scipy pandas scikit-learn jupyterlab onnxruntime xgboost \
  --no-cache-dir
pip install --index-url https://download.pytorch.org/whl/cpu torch torchvision torchaudio \
  --no-cache-dir
pip install tensorflow-cpu --no-cache-dir
pip freeze > requirements.txt

echo "Done. Activate with: source ~/ai/.venv/bin/activate"
echo "Start Jupyter: jupyter lab --no-browser --ip=0.0.0.0"

Conclusion and Call to Action

Cut your AI setup time from hours to minutes by turning this post into a living checklist for your team. Start CPU-first, verify with the smoke tests, then layer in GPUs only when the basics are green.

Next steps:

  • Save the bootstrap script, run it on a fresh VM or laptop today.

  • Convert these commands into an Ansible role or a Dockerfile for CI.

  • Add your project’s extras to requirements.txt and share the checklist in your repo.

If you want a follow-up, tell me your distro and GPU model—I’ll tailor a minimal GPU checklist you can drop into your environment as-is.