FreeBSD Installation

To test my programs against a POSIX system I use both a VM and a local installation of FreeBSD.

VM install notes

Don't use ne2k_pci as network card, at least on my system (with kvm) it produced lots of “nic memory corrupt” errors and network performance is painfully slow (network install is like going back to the modem days :-P) (Inside FreeBSD they're named edX)
HVM default (rtl8139?) works fine (Inside FreeBSD named reX)

Real hardware install

Since I won't be using it and will reside in an external disk I won't be integrating it into my system (boot loader, etc). I'll use the BIOS-builtin boot disk selector.

Here are the abridged steps/progress in its installation. This is very specific to my needs and mainly useful to myself, I recommend you follow the (much clearer) FreeBSD handbook instructions.

Main reference: http://www.freebsd.org/doc/handbook/install.html

  • Pre installation:
    • Disk layout: I'll partition the disk into ~20GB pieces, so that I can install other alternate OSes; with cfdisk from Linux.
      • I'll be installing in /dev/sdX2. /dev/sdX1 will be reserved for some variation of Linux and GRUB, probably
    • Source: I'll be using an ISO from ftp://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-amd64/. I'll be using 8.0-RELEASE, CD-Disc 1
      • Note! Up until now I've been using FreeBSD 7.1-RELEASE for my tests.
    • I'll be converting the ISO into an FTP hierarchy
      • I've already FTP setup (ProFTPd) but no anonymous access is allowed. Enabled with:
        <Anonymous ~ftp>
        	User			ftp
        	Group			nogroup
        	UserAlias		anonymous ftp
        	RequireValidShell	off
        	DirFakeUser		on	ftp
        	DirFakeGroup		on	users
        	<Directory *>
        		<Limit WRITE>
        			DenyAll
        		</Limit>
        	</Directory>
        </Anonymous>


        Symlinks won't be able to escape the root jail so hardlinks or mount --bind are required.

      • ISO temporarily accessible as ftp://SERVER/freebsd/ :
        # cd ~ftp
        # mkdir freebsd
        # mount -o loop PATH_TO_ISO ~ftp/freebsd


        Now can install by setting FTP as media, choosing Other as site and putting the ftp path (source: handbook)

    • Since I decided a long time ago to stop using blank discs whenever possible, I'll be starting the installation from USB. To make things as hard as possible Since all my USB sticks are full of crap right now I'll be using an SD card and a multi-slot card reader.
      The quick and dirty way will be to use unetbootin to make a bootable USB disk. After a lot of trial and error I found out it's better to let unetbootin download the iso and format the SD card as FAT (it failed with an external iso and/or ext2).
      • A couple times in the past I disabled other disks so that the OS saw its disk as the first one, which worked great for Windows; but the BIOS in my current motherboard is a mess and I'm unable to do this.
    • Installation begins
  • Installation
    • Let's see if I don't wipe the wrong disk :P
      • Trial & error and… ad14 matches the fdisk I just run while on Linux. sysinstall's fdisk:
        • Delete all slices (the disk is empty anyway)
        • Create slice, 20480M, 131 (ext2fs) ⇒ ad14s1
        • Create slice, 20480M, 165 (FreeBSD) ⇒ ad14s2
        • Finish
        • BootMngr on ad14
        • BSD disklabels ⇒ Auto layout
        • Finish
      • Packages: Minimal + User + Custom: lib32
      • FTP site by URL
      • Go!
        • sysinstall was unable to find any FTP site (although I could ping them just fine) and when they worked writing to disk failed. I went ahead with the install and was able to boot it. Once booted I re-run sysinstall to install any missing stuff and it worked.
        • Both Linux and Windows have survived unharmed.
        • Time to fix the installation…
          • Re-running systinstallinstall additional distributions… local FTP. This time it appears to work.
      • Installation details:
        • Network card is re0
        • First user UID was 1001. Set it to 1000.
        • Root has no password (due to the initial installation problems)
      • Let's start installing packages I'll need to work on vcs1) and mp3plot (with sysinstall, Configuration → Packages → FTP → (remote site) or pkg_add -r):
        • # pkg_add -r bash mplayer ffmpeg vim subversion
          # pkg_add -r xorg gnome2
      • Everything is fine. Only gripe: No nvidia driver yet (which I already knew) but that means the stupid fan is always at max and driving men uts.
        Anyway, time to install i386 version.

i386 time. This should be easier now I've seen some pitfalls. I will be using remote FTP from the start this time around.

  • unetbootin…
  • boot from SD card…
  • First tricky part: partitioning. I'll have to use first partition this time; should have learned about BSD disklabels and layouts before :-P. If I ever install an alternate linux in this disk, it can be installed anywhere else.
    ad14s1. Delete all ad14s2 disklabels from the list. Auto disklabels:
    ad14s1a / (512M)
    ad14s1b swap (4G)
    ad14s1d /var (4G)
    ad14s1e /tmp (512M)
    ad14s1f /usr (11G)
  • Minimal+User
  • FTP, nearby site
  • DHCP, manual hostname
  • DNS failed. I'll be pinging my choice next time. Choose one that responds and… fail! aaaargh WTF? Switch to repair shell.
  • Reboot:
    • fdisk, disklabel, User, FTP, main site… and now it works. :?

System configuration

  • Add normal user to wheel group to allow issuing su 2)
    # pw usermod myuser -G wheel
  • Switch default user's shell to bash:
    $ chsh -s $(which bash)
  • Install desktop environment:
    # pkg_add -r xorg gnome2
    • Enable it:
      echo 'gnome_enable="YES"' >> /etc/rc.conf
  • (i386 only) nVidia driver
    • Install kernel source tree3) to allow compilation of nVidia module:
      # sysinstall

      ConfigureDistributionssrcbase and sys

    • Build it:
      # cd /usr/ports/x11/nvidia-driver
      # make install # Linux compat. Disabled
    • Load at boot 4):
      # echo 'nvidia_load="YES"' >> /boot/loader.conf

      Reboot 5).

    • Enable it in xorg.conf
      • No xorg.conf? Create a skeleton one IF REQUIRED:
        • Stop X
          # /usr/local/etc/rc.d/gdm stop
        • Create skeleton xorg.conf 6)
          # Xorg -configure

          test it with

          # X -config /root/xorg.conf.new -retro

          Only kept relevant sections (Device and a modified Screen)

        • Install it
          # cp xorg.conf.new /etc/X11/xorg.conf
  • Small tricks:
    • Fix arrow keys in vim:
      $ touch ~/.vimrc # The existance of ~/.vimrc is equivalent to ":set nocompatible"
    • Common tools not installed by default:
      # pkg_add -r ImageMagick wget vim fusefs-kmod fusefs-sshfs
    • Enable fuse (+DISPLAY of fusefs-kmod package):
      • # echo fusefs_enable="YES" >> /etc/rc.conf
        # /usr/local/etc/rc.d/fusefs start
        # sysctl vfs.usermount=1

Upgrading

untested yet

FIXME: Is there any safe way of live-upgrading? Is /sbin/sysinstall + Config → Options → Release name change discouraged?

  • Download bootonly ISO
  • Keep note of partitioning scheme, will be needed
  • Boot into bootonly ISO's sysinstall
  • Run upgrade
freebsd/installation.txt · Last modified: 2010/03/10 03:37 by Toni Corvera
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki