Search:  
Gentoo Wiki

HOWTO_Networkless_stage1_Install

This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc


Please improve it in any way that you see fit, and remove this notice {{Cleanup}} from the article. For tips on cleaning and formatting see Cleanup process


Contents

Introduction

It's a fairly common problem. You want to do a stage1 install, but you don't have an Internet connection on that computer. Maybe it's because you don't have an Internet connection at home, or maybe your wireless drivers aren't supported natively by the Linux kernel. Some of you might be reading this because you don't want to sit while you download all the distfiles over your dial-up connection.


What To Do?

So you've decided to do a stage1 without a Linux-compatible NIC, huh? That's OK, it's pretty common, especially with wireless drivers. One example of such is myself: to install my wireless drivers, I need to emerge ndiswrapper. Trouble is, you can't emerge anything until your kernel is configured. So let's do it this way.

You'll need a Windows installation, whether on your computer (you're dual-booting with Gentoo) or on another computer. If you're not dual-booting, you'll need some kind of high-capacity removable media (like a recordable disc or external hard drive; be creative). Dual-booters can just save the files to their hard drive.

If another computer on your network is running Windows XP, share its Internet connection with Internet Connection Sharing (ICS) and then tell your Gentoo box to use it as a gateway. The purpose of this guide isn't to teach you how to set up ICS, so do your own homework. If you're successful, close this window. You don't need this guide. Do the Gentoo installation as instructed.

You will need...

Assumptions

Okay. Now, let me make a couple assumptions about your system.

Let's Go!

Windows: The Software Menace

Download tarballs

Firstly, download the stage1 tarball for your architecture and save it somewhere. Do the same for the Portage tarball. For the sake of clarity, we'll download them to C:\Downloads.

Print this page!

Print out this page before rebooting, since you won't have a network connection! Once your printer spits out this page, insert the LiveCD and reboot, making sure your BIOS is set to boot from a CD.

Gentoo: A New Hope

Extract the tarballs

mkdir -p /mnt/gentoo/mnt/windrive;
mount -t ntfs -o ro /dev/hda1 /mnt/gentoo/mnt/windrive
tar -xvjpf mnt/windrive/Downloads/stage1-x86-2005.0.tar.bz2
tar -xvjf mnt/windrive/Downloads/portage-[insert the date here].tar.bz2 -C usr/
FIXME: mirrorselect cannot be used on a networkless installation. Please provide a workaround.

Bootstrapping

/usr/portage/scripts/bootstrap.sh --fetchonly --pretend 2> /mnt/usbdrive/download.lst

Windows: Attack of the Gates

Prepare to fetch the files

Code: Replace all spaces with newlines
#include <fstream>
using namespace std;

int main() {
  ifstream infile("download.lst");
  ofstream outfile("download.new.lst");
  while (infile.good() && outfile.good() && char ch = infile.get(ch)) {
    if (ch == ' ')
      outfile.put('\n');
    else
      outfile.put(ch);
  }
  infile.close();
  outfile.close();
  return 0;
}
Code: Replace all spaces with newlines
#!/usr/bin/ruby

output = File.open('download.new.lst', 'w')
File.open('download.lst').each_byte do |b|
  ch = b.chr
  if ch == ' ' then
    output.write("\n")
  else
    output.write(ch)
  end
end
output.close
Code: Replace all spaces with newlines
#!/bin/bash

cat "download.lst" | tr " " "\n" > download.new.lst

Alternatively you can copy the following code into an blank html document. Open the HTML file and copy the contents of the download.lst file into the textarea and click the button. Copy the result back into the text file and save.

<html>
<head>
<!--Crude alternative but works.-->
<!--Updated code so it won't crash browser for longer lists-->
<script>
function runFormat(){
  var text = "te"
  text = document.getElementById('te').value
  var newText = new Array()
  newText = text.split(' ')
  document.getElementById('asdf').innerHTML = ""
  text = ""
  for (x = 0; x < newText.length; x++){
      text = text + newText[x] + "<br>";
  }
  document.getElementById('asdf').innerHTML = text;
}
</script>
</head>
<body>
<textarea rows="20" cols="100"  id="te">
</textarea>
<br />
<input type="button" value="Format" onclick="runFormat()" />
<br />
<div id="asdf" style="background-color:green">Text will be outputted here</div>
</body>
</html>

/*Another good idea is using a Python script.*/

Fetch the files

wget -c -nc -i download.new.lst -P C:\Downloads\distfiles

Gentoo: The Penguin Strikes Back

Copy over the downloaded files

cp -L /mnt/windrive/Downloads/distfiles/* distfiles/
time scripts/bootstrap.sh
emerge --deep --emptytree --newuse --pretend --fetchonly system 2> /mnt/usbdrive/download2.lst

Windows: Revenge of the Microsoft

Prepare to fetch the files

Fetch the files

wget -c -nc -i download2.new.lst -P C:\Downloads\distfiles

Gentoo: Return of the Penguins

Copy over the downloaded files

cp -L /mnt/windrive/Downloads/distfiles/* distfiles/

Finally!

Cool! Now just emerge your system like you normally would and continue with installation as normal. If you need to emerge more packages, repeat the above steps. (This is why I told you to get everything at once!)

Concerns or Compliments? Please use the Discussion section.

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Networkless_stage1_Install"

Last modified: Thu, 27 Dec 2007 00:49:00 +0000 Hits: 15,875