Skip to content

Instantly share code, notes, and snippets.

@CalvinHartwell
Last active December 14, 2020 14:21
Show Gist options
  • Save CalvinHartwell/65d855ad0df5f5d25b0d5b9d7aa86a8a to your computer and use it in GitHub Desktop.
Save CalvinHartwell/65d855ad0df5f5d25b0d5b9d7aa86a8a to your computer and use it in GitHub Desktop.
ubuntu 18.04 apt repository creation (server and client)
# Intro
There are two machines, Machine A (repository) and Machine B (client)
These machines are reachable on the same network via IP, but they don't have to be; it is possible to do DNS resolution etc.
I assume the machine you are working on has SSH access and SUDO access to both Machine A and Machine B.
First download the appropriate deb(s) you need, such as microsoft teams or google chrome:
- Chrome (https://www.google.com/intl/en_uk/chrome/) called google-chrome-stable_current_amd64.deb
- Microsoft Teams (https://www.microsoft.com/en-gb/microsoft-365/microsoft-teams/download-app) called teams_1.3.00.5153_amd64.deb
SCP These files to your Repository machine via:
scp google-chrome-stable_current_amd64.deb MachineA:/home/ubuntu/
scp teams_1.3.00.5153_amd64.deb MachineA:/home/ubuntu/
Install apache2, configure repo
# sudo as root
sudo su
# install apache2
apt-get install apache2 -y
#install dpkg-dev for generating metadata
apt-get install dpkg-dev -y
# create amd64 dir
mkdir /var/www/html/amd64
# move the debs
mv /home/ubuntu/*.deb /var/www/html/amd64/
# generate metadata
cd /var/www/html/amd64
dpkg-scanpackages . | gzip -9c > Packages.gz
# make sure ownership is good of directories and files
chown -R www-data:www-data /var/www/html/*
# get the checksum for verification:
sha256sum /var/www/html/debs/teams_1.3.00.5153_amd64.deb
c928d01831b2ae9afd871172a6b56edf1d1c848655482973358f3d206375878d /var/www/html/debs/teams_1.3.00.5153_amd64.deb
Then we setup client 2:
sudo vi /etc/apt/sourcesa.list
# at the bottom of the list, add either:
deb [trusted=yes] http://252.23.174.1/debs/ ./
# OR
deb [trusted=yes] http://252.23.174.1/ debs/
# Then save the file.
# Run update:
sudo apt-get update
# Download or install one of the packages to test
sudo apt-get install teams -y
# OR
sudo apt-get install --download-only teams
# the second command will download the deb to the current directory.
# We can then verify it matches the repo:
sha256sum teams_1.3.00.5153_amd64.deb
c928d01831b2ae9afd871172a6b56edf1d1c848655482973358f3d206375878d teams_1.3.00.5153_amd64.deb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment