Jed’s fridge door notes (a.k.a. “so i won’t forget”)

classic jazz, unix one-liners, anti-theism, crypto

HOWTO update/install/upgrade a debian box with NO internet…

with 9 comments

I specifically emphasize NO, because as I was googling for a good howto on this topic lots of them said “no internet connection” but they tell you to ‘apt-get update’ first which is dumb because you need an internet connection for that. Same thing with using apt-zip.

So here it is:

*** In a computer with a fast internet connection (sadly this can be a Window$ XP box) ***

1. Find/locate your mirrors

Use http://www.debian.org/mirror/list to find a nearby mirror. Let’s use

http://debian.csie.ntu.edu.tw/debian/

2. Copy the “Packages.gz” files from your mirror

Browse through your mirror and go to the dists/ folder. Under that you’ll see different stages of development of Debian. But for now we are only interested in getting you to install more apps on your Debian box and getting it updated in the process — nothing more. I’ll discuss the other ways you can fsck up your box by using the other branches of development like sid and testing in a future post.

Right now, you are interested in the “stable” branch. Go into the “stable/” directory and…

- copy the “Release” and “Release.gpg” files

It would be prudent to take note of where you got your “Package.gz” file and take note of it:

- go into “contrib/binary-i386/” and get “Packages.gz”

- go into “main/binary-i386/” and get “Packages.gz”

- go into “non-free/binary-i386/” and get “Packages.gz”

3. Don’t forget the security updates!

Even if the chances of your non-connected box being hacked is less than the chance that your cat will greet you when you come home, you should still update the security patches for specific apps.

Go to the security updates site at http://security.debian.org/dists/stable/updates/ and you’ll see the same contrib, main, non-free directories.

- copy the Release and Release.gpg files

- go into contrib, main, non-free directories and copy the Package.gz files in them

*** Back at home with the paperweight unconnected Debian box ***

1. Edit your /etc/apt/sources.list to include the mirror you want

deb http://debian.csie.ntu.edu.tw/debian/ main contrib non-free

# dont forget to add your security repository too. we’ll use a standard one

deb http://security.debian.org/ stable/updates main
2. gunzip and rename your corresponding Packages.gz and Release files

For the Package.gz file you got from the contrib directory, gunzip it and rename it with your mirror’s url like this:

debian.csie.ntu.edu.tw_debian_dists_stable_contrib_binary-i386_Packages

do the same for the other Packages.gz files

debian.csie.ntu.edu.tw_debian_dists_stable_main_binary-i386_Packages

debian.csie.ntu.edu.tw_debian_dists_stable_non-free_binary-i386_Packages

we don’t want to forget the security updates:

security.debian.org_dists_stable_updates_contrib_binary-i386_Packages

security.debian.org_dists_stable_updates_main_binary-i386_Packages

security.debian.org_dists_stable_updates_non-free_binary-i386_Packages

Do the same for the Release and Release.gpg files for both the packages and the security updates:

debian.csie.ntu.edu.tw_debian_dists_stable_Release

debian.csie.ntu.edu.tw_debian_dists_stable_Release.gpg

security.debian.org_dists_stable_updates_Release

security.debian.org_dists_stable_updates_Release.gpg

Now copy all those into your /var/lib/apt/lists/ directory. Of course you should be root to do this.

*** testing your mirrors :) ***

Doing a

$ apt-cache search {app}

should work now, try it for your favorite app that is not in your base install (try fluxbox :)

$ apt-cache search fluxbox

fluxconf – Fluxbox configuration utility

fluxbox – Highly configurable and low resource X11 Window manager

etc….

*** INSTALLING APPS ***

As root do this for all the apps you want (after searching for it using ‘apt-cache search’):

# apt-get -qq –print-uris install fluxbox | cut -f 2 -d \’ > getthisappz.txt

Carry that getthisappz.txt file into a computer with fast internet and download the corresponding deb files in it. If you have alot of files in there, you can use my makeurl.pl utility (available at http://jed.sitesled.com/scripts/) and make an html file out of it, then use Firefox’s DownloadThemAll extension to download them in one go.

When you have your *.deb files, just copy them into /var/cache/apt/archives and do ‘apt-get install {pkg}’ simple as that.

Questions? Comments? Corrections? :)

Written by jedrm

September 12, 2006 at 1:07 pm

Posted in Unix One-Liners

Tagged with ,

9 Responses

Subscribe to comments with RSS.

  1. “I specifically emphasize NO, because as I was googling for a good howto on this topic lots of them said “no internet connection” but they tell you to ‘apt-get update’ first which is dumb because you need an internet connection for that”

    Their’s nothing stupid about that. Apt works the same way with CDs.

    Jens

    September 22, 2006 at 11:57 pm

  2. Nope. You do ‘apt-get update’ *only* for online repositories that change periodically because of new packages added/upgraded/etc.

    You don’t do ‘apt-get update’ on a CD repository because they never change. You just add new CDs to the sources.list to make the CD contents accessible.

    Check this HOWTO for example:

    http://beans.seartipy.com/2006/05/06/update-or-install-applications-on-debianubuntu-without-an-internet-connection/

    Instruction #1 is `apt-get -qq –print-uris install pkg`

    What’s wrong with it? If you don’t have an updated pkg list (/var/lib/apt/lists/*) all you’ll get are the files that are on the install cd — nothing more.

    Try doing an `apt-cache search fluxbox` on a freshly installed debian/ubuntu with no internet and you’ll get nothing, because the pkg fluxbox is not yet listed on its pkg lists.

    Pkg lists are updated with `apt-get update`. But you can’t do that without an internet connection. Just try it.

    Thus, this howto :)

    jedrm

    September 23, 2006 at 12:49 am

  3. You might want to use apt-zip or apt-medium *after you transferred the Packages.gz files*. That step is necessary for bootstrapping the process, indeed, and it’s very nice explained. Thanks!

    Viktor

    February 8, 2007 at 4:58 am

  4. [...] being dependent on the net for installs. I upgrade it once in a while via usb. (See my howto on updating debian without internet). The thing about Debian (and the distros based on it) is that it’s still not 100% [...]

  5. zj3t3mju

    September 3, 2008 at 10:25 pm

  6. @zj3t3mju: i don’t use ubuntu.

    jedrm

    September 10, 2008 at 9:33 am

  7. i think, it can work with debian (if you use) because ubuntu use same debian package manager.
    Just do likely

    zj3t3mju

    September 10, 2008 at 9:56 am

  8. @zj3t3mju: thanks for the tip! I’m sure others will benefit from it :)

    jedrm

    September 10, 2008 at 11:10 am

  9. at this time, it not is the way for updating (no version check)

    zj3t3mju

    September 21, 2008 at 10:45 pm


Leave a Reply