Installing Gentoo/Freebsd 7.0

1. Booting the CD

It's time to install Gentoo/Freebsd. First of all, get the boot cd.

# wget

Extract it :

unlzma boot-gentoo-freebsd7.0-minimal.iso.lzma

and burn using your favourite tool.

Then, boot the CD in order to begin the installation process.

Unlike Linux, FreeBSD bases the name of your interface on the driver for the interface. For example, the Intel EtherExpress driver (fxp) appears as fxp0 (driver fxp, first network card). To see what your interface is, use ifconfig:

# ifconfig
       inet6 fe80::2d0::b7ff:febc:4fe3%fxp0 prefixlen 64 scopeid 0x1
       inet netmask 0xffffff00 broadcast
       ether 00:d0:b7:bc:4f:e3
       media: Ethernet autoselect (100baseTX <full-duplex>)
       status: active
lo0: flags=8007<LOOPBACK,MULTICAST> mtu 16384

Currently the boot cd doesn't set up automatically the network. To solve this problem you've to create a simlink :

# ln -s /etc/init.d/net.lo0 /etc/init.d/net.le0
# /etc/init.d/net.le0 start

where le0 is the name of your interface.

If you want to try if the network works:

# ping -c 3

ping -c 3
PING ( 56(84) bytes of data.
64 bytes from ( icmp_seq=1 ttl=53 time=211 ms
64 bytes from ( icmp_seq=2 ttl=53 time=211 ms
64 bytes from ( icmp_seq=3 ttl=53 time=211 ms

--- ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 211.311/211.351/211.426/0.053 ms

2. Partitioning the Drive

Now, it's time to partition your drive. To perform this operation, we'll use sade. In this guide, we'll assume you use all the avaible space for g/fbsd.

# sade

Select the first entry in the menu, "Partition", then make the slice pressing "A", and make it active. Choose to use the default Freebsd bootloader. So, exit sade.
Now enter sade again, select the second entry in the menu, "Label", press "A" to auto-partition the slice, then change the mount points to /mnt/gentoo/tmp, /mnt/gentoo/var, /mnt/gentoo/usr, etc..
Disable softupdates for ad0s1a. Press "W" to write the changes out.

To check that everythin' works, launch:

# mount

and you should see all /mnt/gentoo/* things everything mounted.

Note: /dev/ad0s1 on /mnt/gentoo (ufs, local)
It does not have soft-updates, this means it'll work fine.

3. Get the overlay and the stage.

Download the overlay and untar it to /mnt/gentoo/usr/local:

# cd /mnt/gentoo/usr/local
# wget
# tar -xjvf gentoo-bsd-overlay.tar.bz2

Same for the stage, but in /mnt/gentoo:

# cd /mnt/gentoo
# wget
# tar -xjvf stage3-i686-freebsd-7.0.tar.bz2

4. Chroot

In order for your install to work, you need to mount the /dev filesystem from the currently running system into the Gentoo/FreeBSD mount point before proceeding with the chroot.

# mount -t devfs none /mnt/gentoo/dev
# cp /etc/resolv.conf /mnt/gentoo/etc/
# chroot /mnt/gentoo /bin/bash
# chroot /mnt/gentoo /bin/bash

5. Syncing the tree

# emerge --sync

However, it's possible to obtain the entire tree in another way:

# cd /
# wget
# tar -xjf portage-latest.tar.bz2 -C /usr/
# emerge --metadata

After, don't forget to symlink the profile:

# ln -sf /usr/local/gentoo-bsd/profiles/default-bsd/fbsd/7.0/x86/ /etc/make.profile

After, you've to edit /etc/make.conf. Unfortunately nano of vi aren't part of the boot cd, so you've to use another way to edit make.conf. Default options are fine, you've only to:

# echo 'PORTDIR_OVERLAY="/usr/local/gentoo-bsd"' >> /etc/make.conf
# echo "../../../../../../portage/profiles/default-bsd/fbsd" > /usr/local/gentoo-bsd/profiles/default-bsd/fbsd/7.0/parent

Note: The ~x86-fbsd keyword does not yet fully cover the same tree as ~x86, but please do not put ~x86 in ACCEPT_KEYWORDS. Rather use /etc/portage/package.keywords to test packages, and report working packages on Bugzilla.

Now, if you want (optional) you can rebuild _all_ freebsd core packages:

# emerge -e system

6. Configure your kernel

Now, you've to paths to seek. You can use the kernel on the bootcd or compile either by yourself. In this guide we'll seek the first way.

Press Alt + F2 to to to a new virtual terminal outside the chroot. Then type:

# cp -pPR /boot/kernel /mnt/gentoo/boot/
# cp /boot/device.hints /mnt/gentoo/boot/

Now, you've the kernel, you're ready to boot, all that is left is the configuration of the network and the bootloader.

7. Configure the bootloader

Note: Remember that in this guide we'll assume to use Freebsd bootloader, so you haven't to install grub or lilo.

You've to edit some configuration files: now you can emerge nano or vi to do this, so do it.

# emerge -av nano
# disklabel -B ad0s1
# nano /etc/fstab

and edit it to get something like:

#Device         Mountpoint      Fstype          Options         Dump    Pass
/dev/ad0s1b     none            swap            sw              0       0
/dev/ad0s1a     /               ufs             rw              1       1
/dev/ad0s1d     /var            ufs             rw              2       2
/dev/ad0s1e     /tmp            ufs             rw              2       2
/dev/ad0s1f     /usr            ufs             rw              2       2
/dev/acd0       /cdrom          cd9660          ro,noauto       0       0

8. Configuring the network

After you made a symlink to get your network working, as explained at paragraph 1

# ln -s /etc/init.d/net.lo0 /etc/init.d/net.le0

You've to add that interface to the default runlevel:

# rc-update add net.le0 default

If you'll use dhcp, you've to install the daemon:

# emerge -av dhcpd

9. Configuring the hostname

# nano /etc/conf.d/hostname
(Set the HOSTNAME variable to your hostname)

10. Setting the domainname

# nano /etc/conf.d/domainname
(Set the dns_domain variable to your domain name, and lo to your local
network interface)

If you have a NIS domain, you need to define it in the /etc/conf.d/domainname file:

11. Setting the NIS domainname

# nano /etc/conf.d/domainname
(Set the nis_domain variable to your NIS domain name, and lo to your local network interface)

12. Changing the root password and adding a new user

# passwd
# adduser
Username: fred
Full Name: Fred Smith
(Accepting the default here, just hit Enter.)
Uid (Leave empty for default): 1001
(OK to accept the default here as well; hit Enter.)
Login group [fred]:
(Enter your groups here, space separated. They must exist.)
Login group is fred. Invite fred into other groups? []: wheel portage
(OK to accept the default here, hit Enter)
Login class [default]:
(Somewhat of a personal preference.  Make sure the shell exists in /etc/shells)
Shell (sh bash tcsh csh esh ksh zsh sash nologin) [sh] bash
(OK to accept the default here, hit Enter for all these)
User password-based authentication [yes]
Use an empty password (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password: password goes here
Enter password again: retype it
(OK to accept the default here, hit Enter)
Lock out the account after creation? [no]:
Username    : fred
Password    : *****
Full Name   : Fred Smith
(This will vary)
Uid         : 1002
Class       :
Groups      : fred wheel portage
Home        : /home/fred
Shell       : /bin/bash
Locked      : no
(Confirm the information is correct)
OK? (yes/no): yes
adduser: INFO: Sucessfully added (fred) to the user database
Add another user? (yes/no): no