One-command provisioning for Ubuntu 24.04 servers aimed at AI workloads and backends: NVIDIA drivers and CUDA (official NVIDIA repo), Docker, a shared Python virtualenv with PyTorch and common ML libraries, Node.js LTS with PM2, plus SSH and a basic UFW policy.
- Ubuntu 24.04 (noble)
- sudo / root access
- NVIDIA GPU present on the machine (CPU-only hosts are not supported by this installer)
- Outbound network for
apt, NVIDIA, NodeSource, Docker Hub, and PyPI
-
Optional: tune variables (copy the example env file):
cp config/env.example config/env # edit config/env if you need different CUDA / PyTorch index / driver mode -
Run the installer:
chmod +x setup.sh sudo ./setup.sh
-
Read progress on the terminal; full output is appended to
logs/setup.log.
| Stage | Contents |
|---|---|
system |
apt update/upgrade; build-essential, git, curl, wget, unzip, htop, driver helpers, pciutils, etc. |
nvidia |
Proprietary driver (ubuntu-drivers or pinned metapackage), NVIDIA CUDA network repo + toolkit package, nvidia-smi verification |
docker |
docker.io, service enabled, invoking user added to docker group, hello-world check |
python |
python3, pip, venv; venv at /opt/ai-env (configurable); torch, torchvision, torchaudio, transformers, diffusers, accelerate |
node |
Node.js LTS via NodeSource (skipped if an existing Node is new enough), pm2 global |
security |
openssh-server, UFW with OpenSSH allowed then firewall enabled |
Scripts are idempotent: safe to re-run after fixes or reboots; already-satisfied steps are skipped where practical.
- GPU: If the NVIDIA step asked you to reboot, do that, then run
sudo ./setup.shagain. - Docker as your user: Log out and back in, or run
newgrp docker, before using Docker withoutsudo. - Python:
source /opt/ai-env/bin/activate(path overridable viaAI_VENV_PATHinconfig/env).
Initialize and push (use your real URL):
git init
git add -A
git commit -m "Initial commit: Ubuntu 24.04 AI/backend setup scripts"
git branch -M main
git remote add origin https://github.com/<org-or-user>/shivay-infra-setup.git
git push -u origin mainUFW is enabled with SSH allowed. Review rules and SSH hardening for production (keys, PermitRootLogin, fail2ban, etc.) before exposing the host.
Use and modify for your infrastructure as needed.