2009-08-11

FreeBSD - Quick install guide (aka How to install FreeBSD)

Much great have been said on FreeBSD;
  • the license has all the freedom you need
  • server apps setup are mostly manual. no wizard of oz, no gui. Which makes the administrator have control over everything.
  • it boots faster
  • its stability is like rock, hard to crash :)
  • default installation are lean and mean. Is meant to be built from scratch. Ain't no rubbish you want on the system to trade for vulnerabilities.

Even though some of the above might scare off a normal user, no doubt it is still a great OS that no others can beat. Don't believe me? Try it yourself with the below few pictures (to guide) :


This quick installation guide will based on the scenario describe below :
  • The hard disk of this installation is 2 GB only.
  • Physical memory is only 256 MB.
  • 2 partitions are needed. 1 for the file system and the other is for swap. The swap partitions size will have to be at least twice the size of the physical memory. In summary, mount point "/" will have 1500 MB and swap will have at least 512 MB.
  • This guide will break into 3 sections; OS Installations (Section 1), Networking Setup (Section II) & Software Installations (Section III).
  • In the OS installations, we will only install minimal packages then other software in section III (software installations)
  • In Section I (OS Installations), pictures on the left can be enlarge by clicking on it.
  • Software Installations (Section III) will use ports to install.

Section I - OS Installations

Boot the computer from CD and press enter for the default option :

"1. Boot FreeBSD [default]"
In the "Country Selection" menu, choose your country.
Choose the "Custom Begin a custom installation (for experts)" option for this installation
Choose option 3 :

"Partition" to "Allocate disk space for FreeBSD"
Press "C" to "Create Slice".
Use the default value for the size of the FreeBSD slice (which is the whole available free space).
Use the default type for the partition type that we are going to create (which is UFS, a FreeBSD native file system)
Set the slice we just created as bootable with the key "S" (Set Bootable) then quit the "FDISK Partition Editor" by pressing the key "q".
In the screen "Install Boot Manager for drive xxx?", choose the option "Standard Install a standard MBR (no boot manager)" option.
Next, choose option 4 :"Label     Label allocated disk partitions".
At the top of "FreeBSD Disklabel Editor" screen, there will be a list of disk slice we created previously. Choose the first (and only one, in this example) disk and press "C" to create partition.
Enter "1500M" for 1.5 gigabyte as the size (and the remaining 512 megabyte as swap for 256 megabyte physical memory)
Choose the option "FS      A file system" to create the installation partition.
Type "/" as the mount point.
Press "C" on the "Disk" listed on the top of the screen again to create another partition. Then press enter for the default value which is the remaining disk space to create the swap partition.
Choose the option "Swap     A swap partition" as the partition type.
Next, choose option 5 to select the packages we are going to install :

"Distributions Select distribution(s) to extract"
In the "Choose Distributions" screen, choose option 4 :

"Developer Full sources, binaries and doc but no games"
In this screen, choose "Yes" to install the ports collection from the CD.
Next, choose option 6 :

"Media Choose the installation media type".
Choose option 1 :

"CD/DVD Install from a FreeBSD CD/DVD" as the installation media.
Now, is time to commit all settings. Choose option 7 :

"Commit Perform any pending Partition/Label/Extract actions" to proceed.
At the confirmation prompt, choose "Yes".
Sample of the installation screen shot.
After the installation have finished, quit the menu by choosing "X Exit Install" at the bottom of the menu and it will reboot.

Section II - Networking Setup

  1. Log in as user name "root" when presented with the login prompt
  2. Change the root password on the first reboot, by executing the command :
    passwd
  3. Setup the networking so that this box can connect to internet and grab the necessary files to proceed Section III, Software Installations. For dynamic IP assignment, use this post to setup "FreeBSD networking – IP address automatically assign aka DHCP". Or fix IP assignment, use this post instead "FreeBSD networking – How to assign or remove fixed IP".

Section III - Software Installations

  1. Populate and update the ports repository index :
    portsnap fetch extract update
  2. After the update, go to ports directory :
    cd /usr/ports
  3. For this guide, we will try to install Apache 2.2 . Search the repository by running the below command :
    make search name=apache-2.2

    Take note of the value :
    Path:   /usr/ports/www/apache22
  4. Go to directory shown in Step 3;
    cd /usr/ports/www/apache22
  5. Install the software :
    make install clean
  6. Once Apache installation have been done, test the software by checking the version :
    httpd -V

Some notes on FreeBSD behavior :

  • configurations are in /etc & /usr/local/etc
  • services needs to define its start up parameter in /etc/rc.conf . The default values can be found in /etc/default/rc.conf or the start up scripts in /etc/rc.d/ or /usr/local/etc/rc.d/
  • kernel boot parameters are loaded from /boot/loader.conf and the default available values can be found at /boot/defaults/loader.conf .
  • system periodic jobs are define in /etc/defaults/periodic.conf but DO NOT change them. Instead, copy it and change in /etc/periodic.conf (create this file if it does not exist).

You have now a working FreeBSD installation !!! Of cause there are still other stuff to work on but this quick installation guide serve as a starting point for anyone who wish to venture their time on FreeBSD. For a recent built hardware & fair internet speed, it takes less then 1/2 an hour to get the above FreeBSD installation up & running.

Have fun, ciao !!!

No comments: