All pastes #237769 Raw Edit

Someone

public text v1 · immutable
·published 2006-11-04 19:10 UTC
rendered paste body
I don't like sysinstall. I consider it to be the worst part of FreeBSD and an experience that no new user should have to go through. That 
said, here are instructions for installing FreeBSD without using the sysinstall interface.

Note: you need disc1, not just bootonly. bootonly lacks a livefs.

This assumes you are making a Dedicated Disk, without an MBR. I find it the most convenient, however this is a destructive method. It /will/ 
overwrite everything on your hard drive, if you follow my instructions exactly.


In the initial sysinstall menu, go to Fixit -> CD/DVD.

Environment.
=============================================================

A few environment variables need to be set, first:

export EDITOR=ee

or

export EDITOR=vi


export DESTDIR=/mnt

this is where our freebsd install will be mounted to so we can install the sets.



Disk Preperation.
=============================================================

first, choose the disk you are going to use. In my example I'm going to use ad0 (primary master ATA hard drive)

to get a list, use:

	geom disk list

now, the strange part.
the livefs is mounted in /mnt2, but alot of the geom utilities are relative to /, so they don't work (at least on my -current snapshot).
to be safe, chroot to /mnt2, create a devfs there, and do all geom work there:

	chroot /mnt2

and

	 mount_devfs devfs /dev

first, we give the drive a name, let's call it drive0:

	geom label load
then:

	geom label label -v drive0 /dev/ad0

GEOM labeling now will give you alot of flexibility when it comes to the disks, no matter where the disk is or what id number it gets the 
geom_label driver will assign it this device name. It makes writing fstab and config files alot simpler.


now, we write a label the disk:

	bsdlabel -w /dev/label/drive0

and make it bootable:

	bsdlabel -B /dev/label/drive0

now, we edit the label:

	bsdlabel -e /dev/label/drive0

(if you haven't exited out of the chroot, you'll get an error as it will attempt to write to the read-only cd, just type exit and continue with the instructions)

this will open EDITOR and let you edit the disk label, resizing and so on. 
for the example, we'll just change a's fstype from unused to 4.2BSD and exit out.
this will give one big root filesystem, and no swap space. You can just as simply add more partitions. Just remember you need to add them to 
fstab!


Creating the Filesystem.
=============================================================

first, we create a clean ufs2 filesystem on a, and name it 'root'

	newfs -L root /dev/label/drive0a

now, we mount it:

	mount /dev/ufs/root /mnt



Copying over distfiles.
=============================================================

in /mnt2, there will be a directory named, for example, 7.0-CURRENT-200610, or 6.1-RELEASE.

this directory contains the distribution sets and the installer files.

the two we definately need are base, and kernels.

first:

	cd base

then:

	./install.sh

It'll prompt for an 'are you SURE', then begin copying all the system binaries to the hard drive.

now:

	cd ../kernels

all dists are installed using a ./install.sh script, some, like kernels', need an extra option.
for example, the name of the kernel you want to install.
6 has SMP and GENERIC on the cd, so pick the kernel and type:

	./install.sh KERNELNAME


The two most important steps
=============================================================

1) run:

	$EDITOR /mnt/etc/fstab

you'll be given an empty file, but write in the name of each partition you've created, and where they are mounted to. For our example, it 
would be:

	/dev/ufs/root		/		ufs	rw	1	1


2) run:

	$EDITOR /mnt/boot/loader.conf

you'll also be given an empty file, but add these two lines:

	kernel="GENERIC"
	geom_label_load="YES"

now: 
	umount /mnt

exit sysinstall or just power off the machine.



Notes
=============================================================

NOTHING IS SET UP! rc.conf is empty and the root account is passwordless. This /is/ a base FreeBSD install.
Please note this and edit rc.conf and passwd your accounts accordingly.