Skip to content

Instantly share code, notes, and snippets.

@piaverous
Last active October 23, 2021 21:24
Show Gist options
  • Save piaverous/35c7900716ba107ecae28017b0896402 to your computer and use it in GitHub Desktop.
Save piaverous/35c7900716ba107ecae28017b0896402 to your computer and use it in GitHub Desktop.
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://fr.archive.ubuntu.com/ubuntu/ bionic main restricted
# # Major bug fix updates produced after the final release of the
# # distribution.
deb http://fr.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# Download Aptly
wget https://github.com/aptly-dev/aptly/releases/download/v1.4.0/aptly_1.4.0_linux_amd64.tar.gz
tar -xzf aptly_1.4.0_linux_amd64.tar.gz
# Move Aptly into your PATH
sudo mv aptly_1.4.0_linux_amd64/aptly /usr/bin/aptly
# Create a local Ubuntu mirror
aptly mirror -architectures="amd64" create ubuntu-bionic http://fr.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
# Update your local mirror
aptly mirror update ubuntu-bionic
aptly snapshot create my-ubuntu-snapshot from mirror ubuntu-bionic
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
# Generate a GPG key
gpg --full-generate-key
# You should get an output looking like this
-----------------------------------
sec rsa3072 2020-06-25 [SC]
305D2741842C85E88FAEFE57EDE7437687457710
uid Pierre A <pierrea@padok.fr>
ssb rsa3072 2020-06-25 [E]
aptly publish \
snapshot \
-distribution="bionic" \
-architectures="amd64" \
-gpg-key="305D2741842C85E88FAEFE57EDE7437687457710" \
my-ubuntu-snapshot
public
├── dists
│ └── bionic
└── pool
└── main
├── 0
├── 2
.
.
├── v
├── w
├── x
├── y
└── z
server {
listen 80;
server_name my.debian.mirror.domain.name;
access_log /var/log/nginx/packages-error.log;
error_log /var/log/nginx/packages-error.log;
location / {
root /home/pierre/.aptly/data/public;
index index.html;
autoindex on;
}
}
gpg --armor --output ~/.aptly/data/public/gpg --export 305D2741842C85E78FAEFE57EDE7437687457710
# Trust your mirror's public key
wget -O - -q http://my.debian.mirror.domain.name/gpg | sudo apt-key add -
# Add your Debian mirror to source list
echo 'deb http://my.debian.mirror.domain.name/ bionic main' | sudo tee -a /etc/apt/sources.list
# Update apt cache
sudo apt update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment