Creating and hosting your own apt repo

Creating your debian package

creating folder structure for package named nezuko

                
mkdir -p nezuko/DEBIAN
mkdir -p nezuko/usr/bin/
vim nezuko/DEBIAN/control # or editor of choice
				
            	

(nezuko/DEBIAN/control)

                
Package: nezuko
Version: 0.0.1
Architecture: amd64
Maintainer: phoenixthrush <contact@phoenixthrush.com>
Description: does something nice
                
            

don't forget to copy your executable to nezuko/usr/bin
chmod it using "chmod +x nezuko/usr/bin/xyz"

building the deb file

            
dpkg-deb --build nezuko
            
        

rename your nezuko.deb to nezuko_0.0.1-1_all.deb

Create new repo

install needed dependencies

            
sudo apt install gnupg dpkg-dev -y
            
        

optionally create a directory with all your deb packages

            
mkdir packages
cd packages
            
        

change everything needed

            
EMAIL="contact@phoenixthrush.com"

gpg --full-gen-key
gpg --export-secret-keys "${EMAIL}" > my-private-key.asc
gpg --import my-private-key.asc
gpg --armor --export "${EMAIL}" > ./public.gpg

dpkg-scanpackages --multiversion . > Packages
gzip -k -f Packages
apt-ftparchive release . > Release

gpg --default-key "${EMAIL}" -abs -o - Release > Release.gpg
gpg --default-key "${EMAIL}" --clearsign -o - Release > InRelease

echo "deb [signed-by=/usr/share/keyrings/phoenixthrush-archive-keyring.gpg] https://phoenixthrush.com/repo/stable ./" > phoenixthrush-packages.list 
            
        

if you want to add more deb packages afterwards

            
EMAIL="contact@phoenixthrush.com"

dpkg-scanpackages --multiversion . > Packages
gzip -k -f Packages
apt-ftparchive release . > Release

gpg --default-key "${EMAIL}" -abs -o - Release > Release.gpg
gpg --default-key "${EMAIL}" --clearsign -o - Release > InRelease
            
        

Create a shell script or share this to your friends

            
sudo curl -sSL https://phoenixthrush.com/repo/stable/ultrasecretcert.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/phoenixthrush-archive-keyring.gpg >/dev/null 2>&1
sudo curl -sSL --compressed -o /etc/apt/sources.list.d/phoenixthrush-packages.list "https://phoenixthrush.com/repo/stable/phoenixthrush-packages.list" >/dev/null 2>&1
sudo apt update >/dev/null 2>&1
            
        

don't forget to backup your private key and move it to a secure location!

That's it!

This is just a basic tutorial.
Advanced configurations can be found here.

If you have questions left contact me at contact@phoenixthrush.com and have fun creating your own repo!