Conda Guide

Overview This guide covers installing Conda on Ubuntu 22.04, migrating the Conda path to a data disk, configuring mirror sources (for regions with internet restrictions), and methods for packing environments for offline deployment. Installation Package Use wget or click to download the Installation Package directly. Add Conda to PATH for Persistence # Locate the conda command which conda # Check the conda root installation directory conda info --base # Open ~/.bashrc and add the following line at the bottom export PATH="/home/ubuntu/miniconda3/bin:$PATH" # Apply changes source ~/.bashrc conda init # Restart your terminal session Configure Storage Paths for Environments and Packages # Open ~/.condarc and add the following lines: envs_dirs: - /your/path/to/conda/envs pkgs_dirs: - /your/path/to/conda/pkgs Configure Conda Mirror Sources (China) # Using Aliyun mirrors as an example conda config --add channels https://mirrors.aliyun.com/anaconda/pkgs/main/ conda config --add channels https://mirrors.aliyun.com/anaconda/pkgs/free/ conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/conda-forge/ conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/bioconda/ # Verify the configuration conda config --show channels Create Conda Environments # Create an environment (at a specific path or using the default path) conda create --prefix /your/path/to/conda/envs/my_env python=3.12 conda create -n my_env python=3.12 # Activate the new environment conda activate my_env List Existing Environments conda info --envs Examples: Using pip/uv within Conda # Using pip pip install tqdm -i https://mirrors.aliyun.com/pypi/simple/ # Using uv for faster installation uv pip install tqdm -i https://mirrors.aliyun.com/pypi/simple/ Pack Conda Environments # Pack an existing conda environment: # (Note: Requires conda-pack to be installed) conda pack -n my_env # Transfer the archive to the target server and extract it tar -xvzf my_env.tar.gz -C /your/conda/envs/my_env Dockerizing Local Conda Environments Example Dockerfile: ...

2026-01-07 路 2 min 路 350 words 路 Me

Docker Guide

Overview This guide provides a comprehensive walkthrough for installing Docker on Ubuntu 22.04, migrating the Docker root directory to a data disk, configuring registry mirrors (for regions with internet restrictions), and setting up the NVIDIA Container Toolkit for GPU acceleration. 1. Install Dependencies sudo apt update && sudo apt install -y ca-certificates curl gnupg lsb-release 2. Import Docker GPG Key (Aliyun Mirror) curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/aliyun-docker.gpg 3. Register the Repository echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/aliyun-docker.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 4. Install Docker Engine sudo apt update sudo apt install -y docker-ce # Docker starts automatically on Ubuntu. For WSL, use: sudo service docker start 5. Verify Installation sudo docker info 6. Manage Docker as a Non-Root User # Create the docker group if it doesn't exist sudo groupadd docker # Add your user to the group sudo usermod -aG docker $USER # Apply group changes without logging out newgrp docker 7. Operational Cheat Sheet # List all containers (including stopped ones) docker ps -a # List all local images docker images # Debug the Docker daemon (useful if the service fails to start) dockerd # Retag an image docker tag <image-name-1>:<tag-1> <image-name-2>:<tag-2> # Remove an image docker rmi <image-id-or-name> # Follow container logs (Ctrl+C to exit) docker logs -f <container-id> # Inspect container metadata docker inspect <container-id> # Force remove a container docker rm -f <container-id> 8. Migrating the Docker Root Directory To prevent the OS drive from filling up, migrate the storage path to a data disk: ...

2026-01-07 路 3 min 路 501 words 路 Me