Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Steps for building gentoo for one machine on another machine
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
fishhead
Apprentice
Apprentice


Joined: 07 Mar 2003
Posts: 162
Location: Pasadena, CA

PostPosted: Tue Jun 03, 2003 8:31 pm    Post subject: Steps for building gentoo for one machine on another machine Reply with quote

I had been trying to install gentoo on a quad PPro for about a week, but kept running into problems. The build process had taken me about two days to get to the point where I could build with distcc, so I was not exactly enthusiastic about having to start over from scratch again after trying a few other distros. I decided to instead build gentoo on my (much faster) dual athlon and then transfer that to the other machine. I thought the procedure might be helpful to those in the community, especialy for somewhat newer users or for people with a number of fairly homogenious systems to manage. I will be somewhat specific, using my experience as the base which you can modify as needed.

This goes along with the x86 version 1.4_rc4 instructions, but adapting this to other install procedures shouldn't be difficult. From this point onwards the system that is doing the building (the athlon in my case) will be refered to as the "host", and the other system as the "target".

First of all, you need to check and make sure that you meet the following requirements:

a) The host is the same architecture as the target (i.e. both are x86, both are PPC, ect) and can run code intended for the target. If you plan to use -march in your CFLAGS, you should always use the oldest of the two architectures. I'm know there are ways to get around this requirement, but because I didn't have to do it and have no experience in this area, I will not cover it.
b) You have some way of getting a large amount of data from one machine to another rapidly. A network is prefered and probably easiest. If that is not an option, you can try to put the target's hard drive in the host. If all else fails, be creative ;).
c) The host has enough free space on disk to do all of the building as well as temporaraly holding the target's filesystem.
d) You have the chroot command.

Step 1:
On the host, root thyself and make a directory somewhere to build in - I used /tmp/gentoo but anywhere else is fine too. Make sure you have at least 3Gb available to you. Get the desired stageX-tar.bz from a mirror - found in the /pub/linux/distributions/gentoo/releases/1.4_rc4/x86/x86/stages on ibiblio or the mirrors - move it to the directory you will use ( /tmp/gentoo ) and unzip it using `tar -xvjpf`. This is, in general, Step 8 of the x86 install but perhaps in a diffrent directory than /mnt/gentoo.

Step 2:
Do steps 9-20 on the host in the chroot'ed environment.

Step 3:
Boot the target using a gentoo Live CD, following steps 1-7. Be to start sshd and change root's password so you can log in remotely.

Step 4:
You will now tar directories in preperation to copy them. First, in the host's chroot'd envronment, do:
    # du -hs bin boot dev etc home lib mnt opt root sbin tmp usr var
This may take a while. Since some filesystems can't handle files larger than a ceartan size (2Gb for ext2 and ext3, 4Gb for ReiserFS) problems could occour if you attempt to tar a directory that is larger than 2 / 4 Gb. If one of these numbers is greater than 2Gb, then you will have to split the directory into one or more tars. To tar the directories in the chroot'd envronment on the host, do:
    # cd /
    # tar -c --recursion bin > bin.tar
    # tar -c --recursion boot > boot.tar
    # tar -c --recursion dev > dev.tar
    # tar -c --recursion etc > etc.tar
    # tar -c --recursion home > home.tar
    # tar -c --recursion lib > lib.tar
    # tar -c --recursion sbin > sbin.tar
    # tar -c --recursion usr > usr.tar
    # tar -c --recursion opt > opt.tar
    # tar -c --recursion root > root.tar
    # tar -c --recursion tmp > tmp.tar
    # tar -c --recursion var > var.tar
Once this is complete, you'll want to transfer these files to the target. I used sftp, but you might want to use something else. Make sure you put the tar files in /mnt/gentoo on the target.

Step 5:
To extract the files on the target, do:
    # cd /mnt/gentoo
    # for file in `ls /mnt/gentoo/*.tar`; do tar xfpv $file; done
This will also take a while.

Step 6:
On the target, chroot to the new envronment, like in Step 8 of the x86 install by doing:
    # mount -t proc proc /mnt/gentoo/proc
    # cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
    # chroot /mnt/gentoo /bin/bash
    # env-update
    # source /etc/profile

Step 7:
Do steps 21-26 of the x86 install on the target.


Phew! If you have any comments, don't hesitate to post them. Thanks.
Back to top
View user's profile Send private message
rojaro
l33t
l33t


Joined: 06 May 2002
Posts: 732

PostPosted: Wed Jun 04, 2003 2:51 pm    Post subject: nice post :) Reply with quote

nice post :)
_________________
A mathematician is a machine for turning coffee into theorems. ~ Alfred Renyi (*1921 - †1970)
Back to top
View user's profile Send private message
morgap98
n00b
n00b


Joined: 02 Nov 2002
Posts: 25

PostPosted: Sat Jun 07, 2003 4:31 pm    Post subject: Reply with quote

great post!

question is tho, i have a few laptops that are old that i would like to use with gentoo. The problem is either they don't have a cd drive or they won't boot from the cd.

Is there a way i could use your method of building the packages on my duallie box and transfer them over without using the Gentoo 1.4_rc4 cd?

thanks
Back to top
View user's profile Send private message
fishhead
Apprentice
Apprentice


Joined: 07 Mar 2003
Posts: 162
Location: Pasadena, CA

PostPosted: Sun Jun 08, 2003 12:12 am    Post subject: Reply with quote

morgap98 wrote:
great post!

question is tho, i have a few laptops that are old that i would like to use with gentoo. The problem is either they don't have a cd drive or they won't boot from the cd.

Is there a way i could use your method of building the packages on my duallie box and transfer them over without using the Gentoo 1.4_rc4 cd?

thanks


Do you already have some linux running on them?
Back to top
View user's profile Send private message
morgap98
n00b
n00b


Joined: 02 Nov 2002
Posts: 25

PostPosted: Sun Jun 08, 2003 5:15 am    Post subject: Reply with quote

no i have had an extraordinary amount of trouble getting linux on any of them.

I have a dell latitude 133 MHz machine with 16 MB ram and a 1.4gb hdd, no cdrom.

I also have a thinkpad 760ELD 100 Mhz Machine with 40 MB ram and a 812 MB hdd with a cdrom, although it won't boot from cdrom.

My overall goal is to make these machine useable, linux preferably ( bsds or windows would do as well )

</P33T>
Back to top
View user's profile Send private message
Phlaegel
Apprentice
Apprentice


Joined: 22 May 2003
Posts: 156

PostPosted: Mon Jun 09, 2003 7:05 pm    Post subject: Reply with quote

Good tip, thanks... I'm using it to set up my new server install. It's currently a Debian install, and some of the ancient packages (even in the testing branch) are starting to piss me off. (Cyrus-imap 1.5.19 in testing? WTF?) So, I've got the shiny new Gentoo install built on my desktop box, and I'm emerging all the software I'm going to use (openldap, cyrus, postgres, apache, etc) now, since I want the server up again asap (it's a home server, so it's not vital, but I'm picky). Going smoothly so far, I'm just emerging and configuring apps now...
Back to top
View user's profile Send private message
calm
n00b
n00b


Joined: 07 May 2003
Posts: 6

PostPosted: Mon Jun 09, 2003 7:59 pm    Post subject: Reply with quote

morgap98:

There are a couple of ways to get linux (Gentoo or otherwise) onto a machine without a bootable cdrom drive.

1) Boot floppy - most boot floppies for any old GNU/linux distribution will do but I'd just use tomsrtbt. Also, I believe I've seen some talk about creating gentoo boot floppies on these forums before; you may want to look into those. In this method you just boot to the floppy, get a network up a and copy the built files over as fishhead described or however you're comfortable.

2) Hard Drive swap - You can pull the drive from your laptop and connect it to your host computer, copy over your built files (cp will do, no need for any networking silliness), do whatever setup you need before swapping back (bootloader), swap the drive back, and continue on your merry way. The only caveat here is that you would likely need a laptop drive to normal IDE drive adapter (usually a $10 job).

3) Removable Media - Get a hold of a PCMCIA or Parallel port drive. A cdrom would probably be the most useful, but since you'll be wanting to do your compiling on your host machine anyway, a zip drive or similar beast will get the job done just as well. As you are running into problems booting from cd, I doubt that you'll have luck booting from PCMCIA or parallel, but the boot disk from #1 works here well. Just boot your machine up, tell it where to find your removable media and copy/install to your heart's content.

There are most assuredly other ways to tackle this problem (network boot maybe), but I would say these are by far the most common and most straight forward.

Good luck.
Back to top
View user's profile Send private message
fishhead
Apprentice
Apprentice


Joined: 07 Mar 2003
Posts: 162
Location: Pasadena, CA

PostPosted: Mon Jun 09, 2003 11:54 pm    Post subject: Reply with quote

morgap98 wrote:
no i have had an extraordinary amount of trouble getting linux on any of them.

I have a dell latitude 133 MHz machine with 16 MB ram and a 1.4gb hdd, no cdrom.

I also have a thinkpad 760ELD 100 Mhz Machine with 40 MB ram and a 812 MB hdd with a cdrom, although it won't boot from cdrom.

My overall goal is to make these machine useable, linux preferably ( bsds or windows would do as well )

</P33T>


GRUB can boot off a network. Might want to try this if the laptop has a built in network card. Also see the GRUB info page.
Back to top
View user's profile Send private message
puddpunk
l33t
l33t


Joined: 20 Jul 2002
Posts: 681
Location: New Zealand

PostPosted: Sat Jun 14, 2003 3:40 am    Post subject: Reply with quote

Nice post man ;) I'm going to make use of that when installing Gentoo on my wee server :D

Anyway, I was just wondering, your comment about how certain filesystems can only handle a certain file size, would it help if you gzipped them (or even bzip'd them). It would save a lot of space (lots of puffed up textfiles in gentoo!) and, although taking longer to zip & unzip, you could probably fit a reasonable server disk image into a 2gb bz2 file.

Just a thought ;)

Cheers,
Chris.
Back to top
View user's profile Send private message
xedx
Tux's lil' helper
Tux's lil' helper


Joined: 23 May 2003
Posts: 93

PostPosted: Sat Jun 14, 2003 3:50 am    Post subject: Reply with quote

very helpful post . :wink:
_________________
--+//+
Back to top
View user's profile Send private message
mkli
n00b
n00b


Joined: 11 Dec 2002
Posts: 6

PostPosted: Sat Jun 14, 2003 10:04 am    Post subject: Reply with quote

Once you have a basic install set up (stage3+kernel,nfsd,etc) you can (from the big machine):
Code:
# mount littlemachine:/  /mnt/littlemachineroot
# mount -o bind /usr/portage /mnt/littlemachineroot/usr/portage
# chroot /mnt/littlemachineroot/

..Then emerge your brains out!
I s'pose you could also
Code:
# mount -o bind /var/tmp/portage /mnt/littlemachineroot/var/tmp/portage
before chrooting, to speed things up a little.
Note that if you have your portage tree mounted to /usr/portage then you'll need to use -o rbind.
_________________
http://www.studentsofsustainability.org.au/
Back to top
View user's profile Send private message
sukotto
n00b
n00b


Joined: 11 Aug 2003
Posts: 34
Location: New York, USA

PostPosted: Wed Aug 13, 2003 9:47 pm    Post subject: Re: Steps for building gentoo for one machine on another mac Reply with quote

Another alternative to steps 4 and 5 would be to use rsync instead.

Something like this perhaps
Code:
#rsync -va --stats --progress login@host:/mnt/gentoo root@target:/mnt/gentoo


Sukotto
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum