User Tools

Site Tools


ubuntu:apt:add_local_directory_to_apt_sources.list

Ubuntu - apt - Add local directory to apt sources.list

1. Create the directory to put all the deb files, for example /home/foo/debs:

mkdir /home/foo/debs

2. Put all the deb files into the directory:

mv /home/foo/Desktop/*.deb /home/foo/debs

3. Check the current priorities and section for the package, find entry named Section and Priority:

dpkg --info example_1.2.3-1@i386.deb

NOTE: This returns some information including Section and Priority:

Here is some of the info:

Package: example
Section: editors
Priority: optional
Homepage: http://www.example.com/

4. Create an override file.

An Override file is used to override the default Priority and Section setting of the package.

  • An Override file contains 3 columns: Package, Priority, Section.
    • Package is the name of the Package, Priority is low, medium, high or optional and Section is the section to which it belongs.

Example of override file content:

## Override
#Package priority section
example low editors

5. Create Packages.gz inside /home/foo/debs

cd /home/foo/debs
sudo dpkg-scanpackages . override | gzip -c9 > Packages.gz

6. If you are too lazy to do the override file, you do not have to. Just change the “dpkg –scanpackages” command above to this:

cd /home/foo/debs
sudo dpkg-scanpackages . /dev/null | gzip -c9 > Packages.gz

If you follow this path, ignore step 4 and 5.


7. Add this line to /etc/apt/sources.list

deb file:///home/foo/debs /

8. Re-synchronize the package index files from their sources

sudo apt-get update

9. Install your application:

sudo apt-get install example

NOTE: This has just created a local file repository.

  • apt will fetch the deb files from your local file directory also.
ubuntu/apt/add_local_directory_to_apt_sources.list.txt · Last modified: 2023/06/18 15:09 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki