Update or Install Applications on a Gentoo Machine Without an Internet Connection
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.
- 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. - Also download the following file on the machine with fast Internet connection:
dist-grabber.pyMake 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/binWe’ll need this script file in Step 6.
- On the machine that has a fast Internet connection, download the latest snapshot of the portage tree from:
Gentoo Portage SnapshotsLet’s call this file ’snapshot.tar.bzip’.
- 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)
- 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 )
- 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)
- 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# 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)
Related Posts:
Readers who viewed this page, also viewed:
- GNU/Linux Users vs Rest of the world :)
- ‘wget -c’ Bug in Download Script Generated by Synaptic in Ubuntu 7.10(Feisty Fawn)
- Which is my favourite OS?
- How to Speed up Booting Into GNOME - A Gentoo Wiki Tip
- Update or Install Applications on Debian/Ubuntu Without an Internet Connection