ubuntu – offline local Repository

http://askubuntu.com/questions/170348/how-to-make-my-own-local-repository

sudo apt-get install dpkg-dev

sudo mkdir -p /usr/local/mydebs

Previously downloaded Packages are generally stored on your system in the /var/cache/apt/archivesdirectory.

now copy all pkg into /usr/local/mydebs

dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz

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.

Add to source.list file

vim /etc/apt/source.list

add the line

deb file:/usr/local/mydebs ./

CD Option

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 update-mydebs
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.

*To make an offline Repository Over LAN *

# apt-get install apache2

chose to create a directory /var/www/debs/amd64

Create a Packages.gz file

# cd /var/www/debs/

# dpkg-scanpackages amd64 | gzip -9c > amd64/Packages.gz

Make the repository known to APT

Now the only thing left to do is to let APT know about your repository. You do this by updating your /etc/apt/sources.list file. You’ll need an entry like this one:

deb http://localhost/debs/ amd64/

I used the actual hostname of my system instead of localhost — this way the code is the same for all of the computers on my LAN, but localhost will do just fine if you are running just one computer.

# apt-get update

Advertisements

About bpn4it

Feel Free in Linux. Bipin Patel bpn4it@gmail.com Ahmadabad, Gujarat, India
This entry was posted in Uncategorized and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s