Every Flavour Beans

“The time has come…to talk of many [technologies].” –Lewis Carroll(‘The Walrus and the Carpenter’)
Development Tools. Web Frameworks. GNU/Linux. Nokia N800. Video Encoding.

May 5, 2006

Update or Install Applications on a Gentoo Machine Without an Internet Connection

Filed under: GNU/Linux, Gentoo — tabrez @ 3:35 pm

If you use Gentoo on a computer that doesn’t has a fast Internet connection, you can still update it or install new applications on it, by downloading files on a different system that has a fast Internet connection and then copying them to your machine using media like CD, DVD or a USB Pen Drive. The complete procedure is given below.

  1. Download the following shell script and copy it to the home directory of the local machine:
    shotsync.sh
    If the browser displays the contents of the file, use File->Save As… menu item to save the file. Or right-click on the link and select “Save Target/Link as…” from the context menu.
    We’ll need this script in Step 4.
  2. Also download the following file on the machine with fast Internet connection:
    dist-grabber.py

    Make the file executable and place it in a directory that is in the system PATH.

    sh# chmod +x distfile-grabber.py
    sh# mv distfile-grabber.py /usr/bin

    We’ll need this script file in Step 6.

  3. On the machine that has a fast Internet connection, download the latest snapshot of the portage tree from:
    Gentoo Portage Snapshots

    Let’s call this file ’snapshot.tar.bzip’.

  4. Copy this file in the home directory of the local machine. From the home directory on the local machine, run the following command:
    sh# shotsync.sh snapshot.tar.bzip

    (we had downloaded the shotsync.sh file in Step 1)

  5. On the local machine, create a list of files to be downloaded on the other machine using the following command:
    sh# emerge -uDp –fetchonly world 2> /tmp/distfiles.txt

    (that’s two hyphens(-) for ‘fetchonly’ option)

    (replace ‘world’ with a package name if you don’t want to do a complete upgrade: sh# emerge -uDp –fetchonly lynx 2> /tmp/distfiles.txt )

  6. Copy the file generated in the above step(distfile.txt) to the machine with good Internet connection. Run the following command to download all the packages specified in the distfile.txt file:
    sh# distfile-grabber distfiles.txt

    (we had downloaded distfile-grabber.py script in Step 2)

  7. Copy all the above downloaded files into the /usr/portage/distfiles directory of the local machine. Then perform the final installation using the following command:
    sh# emerge -uD world

    (If you had used a package name in Step 5, use the same here too: sh# emerge -uD lynx)

Repeat Steps 3-7 at regular intervals to keep your Gentoo system updated. If you only want to install applications without doing a complete update of the portage tree(eg. its already updated), you can just follow Steps 5-7 by replacing ‘world’ with the name of the package.

Whenever you need to copy a file from local machine to the machine with fast Internet connection or vice versa, you can use any suitable media like CD, DVD, USB Pen Drive, Portable Hard disk etc.

More info: Gentoo Wiki
All the scripts mentioned in this post are taken from this source.

NOTE 1:
If the machine with fast Internet connection uses the Windows operating system, you can still use the dist-grabber.py script to download the packages, provided you have Python installed on that system(and is in the environment path). If you instead have Perl installed on the system, you can make use of the following perl script for the same job:
dist-grabber.pl

NOTE 2:
If you would rather use wget to download the package files, then get the required URLs, convert the URL list to wget format & then get the package files:

sh# emerge –pretend –fetchonly –update world 2> list.txt
sh# cat list.txt | sed ’s/\shttp:/\nhttp:/gi’ | sed ’s/\sftp:/\nftp:/gi’ > wgetlist.txt
sh# wget -i wgetlist.txt -nc

(that’s two hyphens(-) for ‘pretend’ and ‘fetchonly’ options)


If you want to receive future posts by email, enter your email address here:

Related Posts:

  • Update or Install Applications on Debian/Ubuntu Without an Internet Connection
  • Simple Way to Update Ubuntu Edgy With Slow/No Internet Connection
  • ‘wget -c’ Bug in Download Script Generated by Synaptic in Ubuntu 7.10(Feisty Fawn)
  • How to Speed up Booting Into GNOME – A Gentoo Wiki Tip
  • GNU/Linux Users vs Rest of the world :)
  • Direct Server to Server Copy using FXP
  • Which is my favourite OS?


  • No Comments »

    No comments yet.

    RSS feed for comments on this post. TrackBack URI

    Leave a comment


    Copyright (c) 2006, 2007 Tabrez Iqbal.
    Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved. A copy of the license is included in the section entitled "GNU Free Documentation License".


    Powered by WordPress
    This website is hosted by Dreamhost