Is it possible to install packages using apt-get install
without having HTTP access? In other words, can apt-get install packages from a small local repository?
I know I can use sudo dpkg -i deb_file
to install a package, but this will install only one package at a time and it will fail if the dependencies are not met. This will be a problem if I want to install a package that has many dependencies even if I already have all the required .deb files.
The common work-around is to put your
.deb
files into/var/cache/apt/archives/
. Then anyapt-get install
will look for the files in that cache first, and then try to download them if they are not there.Alternatively, you can
dpkg -i *.deb
to install all packages in the current directory.If you are looking to install standard Debian packages you could use apt-zip that allows you download packages offline and transfer them onto the machine on some sort of removable media. I haven't really used it for a number of years but when I had a slow network connection at home it was a very useful tool.
You can use
apt-offline
orapt-offline-gui
.Pre-requistes: A friend's system with Internet connection. apt-offline installed in both your systems.
The Offline installation is achieved in 3 simple steps.
Step 1:
Generate a signature file on the Disconnected Debian box at home
apt-offline set /tmp/apt-offline.sig
The above command will generate all information required from apt about updating its database.
Step 2:
Download data based on the signature file generated earlier
apt-offline get C:\apt-offline.sig --threads 5
The above command will download data as mentioned in the signature file. To speed up downloads (that can be from multiple apt repositories), in this example we spawn 5 download threads.
Once completed, you could just copy the data (an archive file, if you used the --bundle option) back to the removable medium and copy it back onto your offline host.
Step 3:
Once you're back upon the home Debian machine, you feed the data from the removable medium to apt-offline:
apt-offline install /media/USB/apt-offline.zip
This will update the APT database on your disconnected machine seamlessly.
Apt-offline can be even used in Windows systems. In my opinion,
apt-offline
is the best option for Offline installation.Source