There are 4 steps to setting up a simple repository for yourself
2.Put the packages in a directory
3.Create a script that will scan the packages and create a file apt-get update can read
4. Add a line to your sources.list pointing at your repository
Type in a terminal
sudo apt-get install dpkg-dev
Create a directory where you will keep your packages. For this
example, we'll use
sudo mkdir -p /usr/local/mydebs
Now move your packages into the directory you've just created.
Previously downloaded Packages are generally stored on your system in
/var/cache/apt/archives directory. If you have installed
apt-cacher you will have additional packages stored in its /packages
The Script update-mydebs
It's a simple three liner:
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
Cut and paste the above into gedit, and save it as update-mydebs in
~/bin. (the tilde '~' means your home directory. If ~/bin does not
exist, create it: Ubuntu will put that directory in your PATH. It's a
good place to put personal scripts). Next, make the script executable:
chmod u+x ~/bin/update-mydebs
How the script works:
dpkg-scanpackages looks at all the packages in mydebs, and the output is compressed and written to a file (Packages.gz) that apt-get
update can read (see below for a reference that explains this in
excruciating detail). /dev/null is an empty file; it is a substitute
for an override file which holds some additional information about the
packages, which in this case is not really needed. See deb-override(5)
if you want to know about it.
add the line
deb file:/usr/local/mydebs ./
to your /etc/apt/sources.list, and you're done.
You can burn the directory containing the debs to a CD and use that as
a repository as well (good for sharing between computers). To use the
CD as a repository, simply run
sudo apt-cdrom add
Using the Repository
Whenever you put a new deb in the mydebs directory, run
sudo apt-get update
Now your local packages can be manipulated with Synaptic, aptitude and
the apt commands: apt-get, apt-cache, etc. When you attempt to apt-get
install, any dependencies will be resolved for you, as long as they
can be met.
Badly made packages will probably fail, but you won't have endured
A Ubuntu/Debian repository at the minimum consists of a web server directory containing some
.debpackages and an index file which
apt-getreads to know which packages and versions are available.
You can read Debian's documentation on how a repository is structured here. You can also try just navigating a simple PPA repository with your web browser to see how it looks in practice. (Example link: pypy ppa).
If you're planning on updating it only rarely, it is possible to set up the necessary directories and index files by hand, but probably not recommended. A tool like
debarchivershould help you (although I have not used it personally).
You then just add a new file in
/etc/apt/sources.list.dcorresponding to your new repository. Eg, a new file