Creating your own local compiled packages repository

I’ve had the problem, I needed to create a local repository that will contain all my packages pre compiled so I can just use the apt utility that comes with Debian based systems.

Execute the following commands to prepare your system for this.

mkdir -p /usr/local/deb```

Now let's create a new file called **update** in that directory
```bash
#!/bin/sh
echo "Updating the local repository in" `pwd`
find . -mindepth 1 -maxdepth 1 -type d \
   | cut -c3- \
   | xargs -n 1 -I DIRNAME dpkg-scanpackages DIRNAME /dev/null \
   | gzip -c9 >Packages.gz
[ $? -ne 0 ] \
   && echo "Update failed" 1>&2 \
   && [ `id -u` -ne 0 ] && echo "Maybe you've forgotten to sudo?" 1>&2

This file is to help us create a packaging list that should be used as a repository.

So in our example for Lucid we execute the following commands from /usr/local/deb directory:

mkdir -p lucid/packages

Now all the debian packages that we have we need to put in lucid/packages directory, and after that we need to run the update script from /usr/local/deb directory.

sudo ./update lucid

This will create the necessary structure and files so it can be recognized by apt .

Now we just need to add this repository to the apt sources list

echo /etc/apt/sources.list.d/local.list > deb file:/usr/local/deb/lucid/ ./

After this we run the update command and then we can just use apt to install or upgrade from the command line.

apt-get update
apt-get upgrade

Some resources of where you can implement this: