Skip to content

Instantly share code, notes, and snippets.

@budiantoip
Last active August 25, 2025 20:43
Show Gist options
  • Save budiantoip/ef2bd362c6cbaef194235fc18b4c59ce to your computer and use it in GitHub Desktop.
Save budiantoip/ef2bd362c6cbaef194235fc18b4c59ce to your computer and use it in GitHub Desktop.
Useful Launch Script for Ubuntu
# Run update and upgrade
sudo apt update
sudo DEBIAN_FRONTEND=noninteractive \
     apt-get -o Dpkg::Options::="--force-confdef" \
             -o Dpkg::Options::="--force-confnew" \
     -y upgrade
# Install most needed packages
sudo apt install -y \
    apache2 \
    apache2-utils \
    at \
    certbot \
    python3-certbot-apache \
    curl \
    fail2ban \
    git \
    gzip \
    jq \
    mariadb-client \
    monit \
    net-tools \
    openssl \
    p7zip-full \
    python3 \
    rsync \
    sysstat \
    tar \
    tcpdump \
    unzip \
    vim \
    wget \
    zip
# Clean up any previous (optional)
sudo rm -f /etc/apt/sources.list.d/docker.list
# Create keyring dir (if not already)
sudo install -m 0755 -d /etc/apt/keyrings
# Fetch and **dearmor** Docker’s GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
 | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# Make it world-readable
sudo chmod a+r /etc/apt/keyrings/docker.gpg
# Add the Docker APT repo
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" \
 | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Update package lists
sudo apt-get update
# (Optional sanity check)
apt-cache policy docker-ce | sed -n '1,20p'
# Install Docker Engine + CLI + containerd + Buildx + Compose plugin
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose docker-compose-plugin
# Start/enable and test
sudo systemctl enable --now docker
# Reboot server
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment