Skip to content

Instantly share code, notes, and snippets.

@Anjum48
Last active August 27, 2025 09:11
Show Gist options
  • Select an option

  • Save Anjum48/b75d3a1c5bf82919e0de36dbd04986ea to your computer and use it in GitHub Desktop.

Select an option

Save Anjum48/b75d3a1c5bf82919e0de36dbd04986ea to your computer and use it in GitHub Desktop.
Instructions for a fresh Ubuntu 24.04 install
sudo apt update && sudo apt upgrade -y
sudo apt -y install build-essential git zsh gnome-shell-extension-manager openssh-server curl nodejs htop mdadm ffmpeg lm-sensors npm tree python3-venv
# Latest driver download - CUDA 12.8
# https://developer.nvidia.com/cuda-12-8-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=24.04&target_type=deb_local
sudo apt-get install -y nvidia-open
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-ubuntu2404.pin
sudo mv cuda-ubuntu2404.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/12.8.0/local_installers/cuda-repo-ubuntu2404-12-8-local_12.8.0-570.86.10-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2404-12-8-local_12.8.0-570.86.10-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2404-12-8-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-8
sudo reboot
sudo apt-get -y install nvtop
sudo snap install google-cloud-cli --classic
sudo snap install code --classic
sudo snap install spotify
sudo snap install discord
sudo snap install slack
# Restore RAID arrays
sudo mdadm --assemble --scan
# GitHub CLI
(type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& sudo mkdir -p -m 755 /etc/apt/sources.list.d \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
# oh my zsh
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Nerd fonts https://github.com/romkatv/powerlevel10k#fonts
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.2/Meslo.zip
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf -P Downloads
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf -P Downloads
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf -P Downloads
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf -P Downloads
# powerline10k (remember to add powerlevel10k/powerlevel10k to config)
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
# zsh-autocomplete (remember to add zsh-autosuggestions to config)
sudo git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# https://travis.media/top-10-oh-my-zsh-plugins-for-productive-developers/
plugins=(
zsh-autosuggestions
git
dirhistory
history
sudo
web-search
)
# Escape square brackets for pip
alias pip='noglob pip3'
alias python='python3'
alias ipython="python -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"
source ~/.zshrc
# Terminal properties
# Set font to "MesloLGS NF" & set size
# p10k configure
# CUDA Paths (in ~./zshrc)
# Chech for /usr/local/cuda-XX.X symlink
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}$
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
git config --global user.name "Anjum Sayed"
git config --global user.email "email@address.com"
gh auth login
gcloud auth application-default login
gcloud auth application-default set-quota-project tapesearch-XXXXXX
gcloud config set project tapesearch-XXXXXX
###############################################################
# Set up Jupyter Server https://stackoverflow.com/questions/44231789/run-jupyter-notebook-on-boot-on-ubuntu
# Set up password:
jupyter notebook password
# Create service file:
sudo nano /etc/systemd/system/jupyter.service
[Unit]
After=network.service
[Service]
ExecStart=/home/anjum/.local/bin/jupyter-notebook --no-browser --ip=0.0.0.0
WorkingDirectory=/home/anjum
User=anjum
[Install]
WantedBy=default.target
# Enable & start service
sudo systemctl enable jupyter.service
sudo systemctl start jupyter.service
# Connect venvs to Jupyter (activate venv first)
python -m ipykernel install --user --name=tapesearch
python -m ipykernel install --user --name=kaggle
###############################################################
###############################################################
* Prometheus *
0. Download tar https://prometheus.io/download/
1. Extract
tar xvf prometheus-*.tar.gz
cd prometheus-*
2. Move Binaries to System Path
sudo cp prometheus promtool /usr/local/bin/
3. Create Prometheus User (non-root)
sudo useradd --no-create-home --shell /bin/false prometheus
4. Set Up Configuration Directory
sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus
sudo chown prometheus:prometheus /etc/prometheus
sudo chown prometheus:prometheus /var/lib/prometheus
sudo cp prometheus.yml /etc/prometheus/prometheus.yml
sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml
5. Create a Systemd Service
sudo nano /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus Monitoring
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus \
--web.console.templates=/usr/local/bin/consoles \
--web.console.libraries=/usr/local/bin/console_libraries
Restart=on-failure
[Install]
WantedBy=multi-user.target
6. Reload Systemd and Start
sudo systemctl daemon-reload
sudo systemctl enable prometheus
sudo systemctl start prometheus
systemctl status prometheus
###############################################################
###############################################################
* Redis Exporter *
1. Extract & Move Binary
tar xvf redis_exporter-*.tar.gz
cd redis_exporter-*
sudo cp redis_exporter /usr/local/bin/
2. Create a User
sudo useradd --no-create-home --shell /bin/false redis_exporter
3. Create a Systemd Service
sudo nano /etc/systemd/system/redis_exporter.service
[Unit]
Description=Prometheus Redis Exporter
Wants=network-online.target
After=network-online.target
[Service]
User=anjum
Group=anjum
Type=simple
EnvironmentFile=/home/anjum/github/tapesearch/creds/credentials-api.env
ExecStart=/bin/bash -c '/usr/local/bin/redis_exporter --redis.addr=redis://db.tapesearch.com:6379 --redis.password=$REDIS_PASSWORD --check-keys=celery,celery:1,celery:2,celery:3'
[Install]
WantedBy=multi-user.target
In /etc/redis_exporter.env
REDIS_URI=redis://:<PASSWORD>@<REDIS_HOST>:6379
sudo systemctl daemon-reload
sudo systemctl enable redis_exporter
sudo systemctl start redis_exporter
systemctl status redis_exporter
curl http://localhost:9121/metrics
###############################################################
# Final Tasks
# Set up remote screen sharing
# Remove screen lock
# In extention manager, Allow locked Remote Desktop plugin
# Install Chrome
# Install VSCode
# Install Dropbox
# Install Docker plus move folder
# Install redis-cli
# Install pgadmin
# Setup crontab
# SSH Key pairs https://www.linode.com/docs/guides/use-public-key-authentication-with-ssh/
# - If keys are already generated, run 'ssh-copy-id [user]@[ip-address]'
# Cron jobs
# Clone repos
# Set drive mount points
# Grub boot menu- hit ESC on boot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment