Run sudo apt-get install without internet connection
Solution 1:
Doing this is never ever clean, and never perfect. But below is what I've done to get it to work at times.
You will need a machine that is similar to the FTP server and from the FTP server you will need to download all packages and dependencies. Typically, from the internet machine you will first run:
sudo apt-get clean
The above command cleans the /var/cache/apt/archives/
directory so that you can ensure it only contains the package and dependencies you desire. Then execute:
sudo apt-get -d build-dep <package_name>
The -d
does a download only and build-dep
gets all the dependencies required and drops them into /var/cache/apt/archives/
. This is why you at least need a similar build. Sometimes you may even need to do a sudo apt-get remove <package name>
if your machine already has the package that your destination server requires.
You then take the data out of that directory and put it on some device to transfer to your FTP server. From there you execute on your target machine:
sudo dpkg -i *.deb
The other thing you can do is use apt offline http://apt-offline.alioth.debian.org/
Solution 2:
You'll have to download the packages and it's dependencies. Then place them on the sd card and execute:
cd folder_with_debs
sudo dpkg -i *.deb
Btw, it would be easier in most cases to plug an eth cable into the raspberry pi for short (As you are posting here on SO, you should have access to the internet in general)
Solution 3:
This is a really long comment in response to @Inquisitor.
Super helpful answer, by the way; it got me on the right track. I'm going to include a few notes below for anyone interested; please note that all this runaround ended up not working, and I just downloaded the files directly from:
ftp://ftp.us.debian.org/debian/pool/main/t/tk8.5/
ftp://ftp.us.debian.org/debian/pool/main/t/tcl8.5/
But hopefully this will be useful to someone.
I'm installing tk8.5-dev and tcl8.5-dev on the pi. To do this I found:
https://packages.debian.org/wheezy/armhf/tk8.5-dev/download
https://packages.debian.org/wheezy/armhf/tcl8.5-dev/download
I added the repo (deb http://ftp.de.debian.org/debian wheezy main
) to /etc/apt/sources.list
, then ran sudo apt-get update
. On update, it yelled at me with:
GPG error: http://ftp.de.debian.org wheezy Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 6FB2A1C265FFB764
because I'm not on debian, but I did
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6FB2A1C265FFB764
It told me no ultimately trusted keys found
. I ran sudo apt-get update
again. If you miss a key (like I did originally), it'll tell you There is no public key available for the following key IDs: 6FB2A1C265FFB764
. If you still have problems, this might be helpful, or maybe the --allow-unauthenticated flag.
At this point, I ran
sudo apt-get -d build-dep tk8.5-dev_8.5.11-2_armhf.deb tcl8.5-dev_8.5.11-2_armhf.deb
and got
Unable to find a source package for tk8.5-dev_8.5.11-2_armhf.deb
So I added an architecture to dpkg:
sudo dpkg --add-architecture armhf
sudo apt-get update
And apt-get still wasn't able to find the packages. Sooo I gave up and downloaded the files directly. In my case, since I couldn't use build-dep, I downloaded and installed everything listed here for armhf:
https://packages.debian.org/stable/devel/libxss-dev
https://packages.debian.org/stable/devel/libxft-dev
https://packages.debian.org/stable/devel/tk8.5-dev
https://packages.debian.org/stable/devel/tk8.5
https://packages.debian.org/stable/devel/tcl8.5-dev
https://packages.debian.org/stable/devel/tcl8.5
There are more dependencies, so I'll work through those today and edit this answer if I find anything else interesting.
Of course, all good things are chiastic, so I had to undo everything again, since I don't want to install debian armhf packages on my amd64 mint system:
sudo dpkg --remove-architecture armhf
sudo apt-key del 8B48AD6246925553
sudo apt-key del 6FB2A1C265FFB764
sudo apt-get update
And removed deb http://ftp.de.debian.org/debian wheezy main
from /etc/apt/sources.list
More sources: http://savvyadmin.com/download-pgp-keys-with-apt-key/
Anyway, I don't know if this counts as an answer, but hopefully it'll be helpful to someone.