Skip to content

Advanced Linux AI Development & Containerization

Master advanced Linux development tools, Python environments, Docker containerization, and professional AI deployment workflows on Linux systems.

advanced5 / 5

Development Tools Configuration


# Install Zsh

sudo apt install -y zsh

# Install Oh My Zsh

sh -c "$(curl -fsSL <https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh>)"

# Install useful plugins

git clone <https://github.com/zsh-users/zsh-autosuggestions> ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone <https://github.com/zsh-users/zsh-syntax-highlighting> ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

# Edit ~/.zshrc to enable plugins

plugins=(git zsh-autosuggestions zsh-syntax-highlighting python conda-env)

Configure Git for AI Projects#


# Advanced Git configuration for AI development

git config --global core.editor "code --wait"
git config --global merge.tool "code --wait"
git config --global diff.tool "code --wait"

# Git LFS for large model files

sudo apt install -y git-lfs
git lfs install

# Track common AI file types with LFS

git lfs track "*.pkl"
git lfs track "*.h5"
git lfs track "*.pth"
git lfs track "*.bin"
git lfs track "*.safetensors"
git lfs track "*.onnx"

# Add .gitattributes

echo "*.pkl filter=lfs diff=lfs merge=lfs -text" >> .gitattributes
echo "*.h5 filter=lfs diff=lfs merge=lfs -text" >> .gitattributes
echo "\*.pth filter=lfs diff=lfs merge=lfs -text" >> .gitattributes

Jupyter Lab Configuration#


# Generate Jupyter config

jupyter lab --generate-config

# Install useful extensions

pip install \
jupyterlab-git \
jupyterlab-lsp \
jupyter-ai \
nbdime \
jupyterlab\_code\_formatter

# Configure Jupyter Lab

cat >> ~/.jupyter/jupyter\_lab\_config.py ~/.tmux.conf ~/monitor\_system.sh << 'EOF'
#!/bin/bash
echo "=== System Performance Monitor ==="
echo
echo "CPU Usage:"
top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.\*/\1/" | awk '{print 100 - $1"%

---

## Docker Containerization for AI Applications

# Docker Containerization for AI ApplicationsMaster containerization to create reproducible, scalable AI applications that run consistently across development, testing, and production environments.

## Why Docker for AI Development?

### Reproducibility Challenges in AI
- Environment Dependencies: Complex Python packages, CUDA versions, system libraries
- Version Conflicts: Different projects requiring different package versions
- Deployment Consistency: "Works on my machine" syndrome
- Collaboration Issues: Team members with different OS and configurations

### Docker Solutions
- Isolated Environments: Each container runs independently
- Consistent Deployment: Same environment from development to production
- Easy Scaling: Horizontal scaling across multiple servers
- Version Control: Infrastructure as code with Dockerfiles

## Docker Installation and Setup

### Install Docker on WSL2

```bash

# Update package database

sudo apt update

# Install prerequisites

sudo apt install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release

# Add Docker's official GPG key

curl -fsSL <https://download.docker.com/linux/ubuntu/gpg> | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

# Add Docker repository

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] <https://download.docker.com/linux/ubuntu> $(lsb\_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# Install Docker Engine

sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

# Add user to docker group (avoid sudo)

sudo usermod -aG docker $USER

# Restart shell or run:

newgrp docker

# Test installation

docker --version
docker run hello-world

Configure Docker for AI Development#


# Create Docker daemon configuration for better performance

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<EOF
{
"storage-driver": "overlay2

---
Section 5 of 5
View Original