This guide is designed for users who are new to the FreeBSD Operating System, as well as folks that need a quick refresher of the installation process. The guide will help you prepare your computer for the installation, install the FreeBSD software on your system, and take you through a few of the basic skills you'll need to begin using and configuring FreeBSD.
A more comprehensive guide to installing and using FreeBSD is available on-line, for free, in the FreeBSD Handbook. The FreeBSD Handbook is part of the FreeBSD Documentation Project, a group of volunteers from the FreeBSD community that contribute and organise a wide variety of documenation about all aspects of FreeBSD.
| FreeBSD Handbook: | http://www.freebsd.org/handbook/index.html |
| FreeBSD Documentation Project: | http://www.freebsd.org/docproj/docproj.html |
The FreeBSD Documentation Project includes links to articles on enthusiast websites, support mailing lists, FAQs (Frequently Asked Questions), and more. While FreeBSD doesn't come with a toll free support telephone number, there's a very welcoming community of users who are willing to help you with your questions should you get stuck somewhere along the way. Always check the FAQ and Handbook before posting your question to a mailing list. If you have an Internet connection, it's a good idea to read through some of the material available online before starting your installation of FreeBSD.
|
FreeBSD should be compatible with most "IBM PC compatible" hardware manufactured since the 386. Owners of older systems, especially those based on technologies other than PCI expansion bus for peripheral cards (ISA, EISA, VLB) should pay particular attention to list of devices that FreeBSD supports. The official list of hardware supported by this release can be found in the HARDWARE.HTM (or HARDWARE.TXT if you prefer plain text) file on this disc. Naturally, the more popular the particular piece of hardware you would like to use is, the more likely someone has written the requisite software to make it work under FreeBSD. If you're unsure exactly what hardware you have in your PC, and you already have a version of Microsoft Windows® installed, you should take some time to go through the Device Manager. You can access the Device Manager through the "System" item in the Control Panel, or by right-clicking on "My Computer" and selecting "Properties".
The Hardware Notes for any given release can also be examined online from the FreeBSD website at:
Replace 4.6R with the release number you're using (4.7R, for example).
FreeBSD requires its own reserved disk space to install and operate. FreeBSD cannot share space on your hard drive with other OSes you may have installed on your system, such as Windows® or Linux. To ensure FreeBSD gets the space it needs, you are required to setup a dedicated FreeBSD disk partition. Partitions are simply a way of splitting one physical hard drive into logical sections (to hold different operating systems, or different file systems, for example). You always require at least one partition on your disk, even if you only have Windows® installed (the "C:" drive is in fact a partition). How you prepare your hard drive for installation depends on whether or not you're installing over a previous version of FreeBSD, installing onto a new disk, or installing onto a disk that contains another operating system. Your goal in either case is to have unpartitioned, "free" space on your disk that you can turn into a FreeBSD partition using the FreeBSD Install Program.
Installing over a previous FreeBSD release. If you're installing over an older version of FreeBSD, you don't need to create a new partition or do anything to prepare your drive for this install. During the installation screens you simply select the FreeBSD partition you have already created on your disk.
Installing FreeBSD onto a new disk. To install FreeBSD onto a new disk, you need to create a partition, but you can create this partition using the FreeBSD installation program, so you don't need to do anything special right now.
Installing FreeBSD onto a disk that contains another operating system. If you're planning on replacing whatever operating system (typically Windows®) or data that might be on the disk already, you can erase the existing partition(s) from within the FreeBSD installer and create a new FreeBSD partition. If you plan on sharing the disk with more than one operating system, you will need to repartition it to create a dedicated partition that will hold the FreeBSD operating system.
If you have unpartitioned, free space on your drive, you can create a FreeBSD partition in this space using the FreeBSD installer during the main installation process.
If your drive has no free space, you will need to resize an existing partition to make room for FreeBSD. Resizing partitions is commonly done with one of two utitlities:
FIPS. In the author's own words: "FIPS is a program for non-destructive splitting of harddisk partitions." FIPS is free, and a copy is included on the FreeBSD CD/DVD (in the tools directory). Be sure to read the FIPS documentation: FIPS.doc and FIPS.faq. The latest version of FIPS is always available at http://www.igd.fhg.de/~aschaefe/fips/.
Partition Magic® is a commercial software package from Power Quest® that features an easy to use GUI that runs in all versions of Windows®. If you're uneasy about resizing partitions using FIPS, Partition Magic is a great choice. Learn more at http://www.powerquest.com, and if you decide to purchase, consider The BSD Mail: http://www.bsdmall.com.
It goes without saying that you should backup ALL your data before proceeding with disk repartitioning using FIPS or Partition Magic. Also note that you don't need to actually create a FreeBSD partition with these tools - just leave some free, unpartitioned space and use the FreeBSD install program to create the actual partition.
When you turn on your computer, it must load a sequence of basic instructions before it can even begin to load an operating system. This process had traditionally been called "booting" or "boot-strapping" a computer. Once the boot loader finishes initializing the computer, it goes ahead and loads what's refered to as a "kernel". The kernel is the core of any operating system, and the FreeBSD kernel is what primarily distinguishes it from all other versions of UNIX. The kernel is the brains your computer was looking for that links all the hardware on your system together, lets you create files and store data, makes connections across the Internet, executes programs, and so on. To install FreeBSD, you'll be booting your computer with a special FreeBSD boot loader (the first bit of magic we talked about), starting a real FreeBSD kernel, and running a special setup/install utility that will ask you a series of questions about how to configure FreeBSD on your system and will then copy the FreeBSD files onto your hard drive.
On modern systems with CD-ROM or DVD-ROM drives, you can simply place the FreeBSD CD in your drive and boot from it. Most systems from the Pentium II era and beyond are capable of booting a CD like this - you may have to adjust your computer BIOS settings to instruct your computer to try booting from the CD-ROM. Try placing the FreeBSD CD in your drive and rebooting your computer to verify if your computer is capable of starting the FreeBSD Installation Program in this manner.
On older systems, you can only boot your computer from a floppy drive or from the hard drive. To install FreeBSD, you'll need to create two special floppy disks that will contrain the boot loader, kernel, and setup utility. The FreeBSD files will still be copied from your CD drive. You can also use the floppy technique to install FreeBSD directly from the Internet if you don't have the CDs.
If your system can boot from the CD-ROM drive, you can skip this section. The files you'll need to create the two boot floppies are in the \floppy directory on the CD/DVD. You can also obtain the file from the FreeBSD FTP server: ftp://ftp.freebsd.org/pub/FreeBSD/releases/
When you boot FreeBSD for the first time after completing the installation, you'll see the hardware detection messages scroll by on the screen, followed by some information that indicates what programs are being started. When everything is said and done, you'll be left with ``The Login Screen''. It will resemble the following:
If you've never used a multi-user operating system before (DOS, Windows 95/98/ME,
and Macintosh OS 9 are all single-user) the concept of "logging in"
will be new to you. With FreeBSD, like all UNIX based OSes, multiple people
can use the system, even at the same time. A login is simply the name that you
supply to FreeBSD to identify yourself to the operating system. FreeBSD keeps
track of which names are permitted to log in or access the system, and only
allows valid users to have access. Access is granted if you supply the correct
password. When you successfully log in, you'll be presented with an interface
to the operating system - the Unix Environment covered later in this guide.
Generally, login names reflect a person's real name (mark, ccoleman)
but a login name could just as easily be something like adp23945. Login
names must be unique on a particular system. To gain access to the system, you
type in your login name.When you boot FreeBSD for the first time, the only account
that is valid is that of the SuperUser: root. During the installation
you were asked to assign a password to the root account. Enter that password
now and press ENTER.
FreeBSD login names and passwords are case-sensitive. Root is different than
root, ROOT, and rooT. With out strong reasons, it is suggested that you use
all lowercase for your user names, keeping them to 8 characters.
The root login does not restrict you in any way. You are god of your OS. With
one simple command, you could wipe out everything! Cool huh? For this reason,
use the root login only when necessary. Avoid experimenting with commands when
you are root.
System administration is another term you will see often. A system administrator
is the actual person who sets up and maintains the FreeBSD (or any other) system.
You are the system administrator of your home PC, but your roles (fortunately)
are far less consuming than the system administrator of a large public server.
System administration generally requires SuperUser privileges.
One of the most useful things about FreeBSD is that you can ``log in'' from
just about anywhere! FreeBSD uses the notions of ttys - ``terminals'' that can
attach to a virtual terminal (ttyv - such as your screen), a pseudo terminal
(ttyp - such as a network connections from another Unix or Windows computer),
and serial terminals in case you happen to have an old DEC vt100 terminal device
lying around :-) Terminals, combined with the concept of logging in make FreeBSD/Unix
a dream to administer remotely!
Another side-effect of the multi-user ttys is that YOU can be logged into your
own system as many times as you want. If you've just started FreeBSD for the
first time, then it may not be obvious too you how to get multiple logins going
at the same time. It's easy, just hit ALT-F2 to switch to ``virtual console
2'' and you'll see another login screen. By default, FreeBSD ships with 3 virtual
consoles (ttyv0-2), reachable with ALT-F1,ALT-F2,ALT-F3.
Go ahead and try switching between consoles! Having multiple sessions (logins)
going can be extremely useful. For example, say you want to search for the word
``foobar'' in the entire /usr/src source tree! Depending on the speed of your
disk and CPU, this could take quite a while - say 2 minutes - so instead of
waiting around doing nothing while the command grinds away, you can switch to
another console and continue working on whatever you want.
In FreeBSD (and just about all other UNIX system) the superuser login name
is root. No mater how large or small the system may be, if you can login as
the user root, the system is wide open for you to do whatever you please. Obviously,
letting anyone log in as root is a Bad Thing(tm). Remember, root can do *anything*.
Only you should know root's password.
To prevent unauthorized access, the root login should always have a secure password.
By default, in FreeBSD, root does not have a password; it's up to you to change
it. The trick is picking a good password. It's been known for quite some time
that people tend to pick passwords that they can easily remember (we're humans,
after all): their birthday, their home town, an item on their desk, and so on.
The problem with these passwords is that they are easy to break, either through
guessing or by more sophisticated methods of attack.
So picking a ``good'' password is important if your machine will be connected
to a network (a LAN, or the Internet). The best passwords combine a mixture
of Upper and Lower case characters, as well as numbers. A fine example would
be: 34DodgesU, or Beezl891. It's even better if there are no ``real words''
in your password, since one common form of attack is to exhaustively try common
combinations of words and numbers against your password entry. Personally, I
think a password should be pronounceable, since it minimizes the risk that you
might forget it. Try memorizing S8t4WxlT43Dc23HiiU2 and you'll see what I mean...
Finally, perhaps the best approach to password privacy is to never write your
password down, and to change it every so often. There are system administrators
that change their (and root's) password several times per week. Many people
recommend a more reasonable time frame of 2 to 3 months.
Also remember that you should only be the SuperUser while you are performing
System Administration tasks. For 'normal' activities, it's always a better idea
to do them as a mere mortal since mere mortals can't wipe out the entire operating
system so easily.
To ``become'' the SuperUser while you're a normal user, you need the command
su. su stands for ``switch user'' and you can use it to su to any other user
on the system. If you just type 'su' by itself, it is assumed that you want
to su to root - the SuperUser.
Warning: In FreeBSD, you must be in the wheel group to su to root.
When you're done doing whatever you were doing it's time to log out! You can
either type logout or exit. Once you've logged out, you'll see the Login: prompt
again, indicating your system is ready for more abuse :-)
Note: The term ``account'' is synonymous with ``login'' Some people use the
phrase account to encapsulate a user's entire set of rights and possessions
on the system (his login permissions, files, home directory, mail account, etc.),
and use the term login to refer to the user's ``account name'' At any rate,
the two terms can be used interchangeably and their exact meaning varies depending
on who you talk to :-) For clarity, we will always append ``name'' after account
or login to indicate we're only talking about the user's login name...
The Unix environment, for the most part, involves two aspects:
* The Shell
* The User Environment
I can't really tell you exactly what the Unix environment is - but I can tell
you what most people believe contribute to "it". Really, the Unix
environment is just FreeBSD's interface onto itself. Huh? Think of it this way:
You need to get things done, and the operating system is willing and ready to
perform these tasks. But you need a way to talk to FreeBSD before you can go
anywhere. The "Unix Environment" is the collective services, features,
and ideologies that represent the interface to the operating system. If you
want to work with FreeBSD (or any Unix for that matter), you need to use the
Unix environment to get your work done. As we will see, the Unix environment
not only ``lets'' us get our jobs done, but influences how we approach and solve
problems. I'll talk about this philosophy of design after a brief introduction
to ``The Shell'' We will end up this section with a hands on walk through of
how to use the shell, and the rest of the Unix Environment.
The most visible part of the Unix system -- the part that prompts you for commands
and appears to do your bidding is the shell. A shell is a user interface: it
talks to the Operating System for you and grants each logged in user system
resources (like processor time, disk storage, memory, etc.). The primary purposes
of the shell are to provide prompting, command interpretation and execution,
and error reporting. You tell the shell what you want done by typing in commands
after the prompt. It's very similar to the command interpreter under DOS, but
infinitely more powerful and functional. Instead of presenting users with "C:>",
most Unix shells present you with "$" or "%". Naturally,
the prompt can be changed - more on that later!
There are many different Unix "Shells" available. By default, most
people will be using the ``C Shell (csh)'' under FreeBSD. You can tell if you
are using this shell if your command prompt has an "%" in it. The
C Shell is thus called because it is modeled after the C language syntax. For
added functionality (including command line editing and an interactive ``history''
mechanism), you can use "tcsh", which has become quite popular and
has very similar syntax to the csh. Also available are the Bourne Shell (sh)
and the Bourne Again Shell (bash). bash is the default on Linux systems, whereas
tcsh or csh are generally the defaults on BSD systems. Finally, there is also
the Korn Shell (ksh) written at Bell Labs - ksh has become a de facto standard
on System V based UNIXes. There is a free implementation called "pdksh"
(public domain ksh). Many people consider the tcsh the most feature rich, but
that doesn't mean it's right for you. The only way to know for sure is to try
them all out and see which one turns your crank. tcsh, bash, and pdksh are all
available in the FreeBSD Packages Collection.
Note: Although you spend most of your time in what's known as the ``interactive
shell'', most shells also provide a high-level programming language (scripting
language) that is typically used to automate mundane day to day tasks. That
being said, Perl is quickly replacing this use of shell languages in many sysadmin
circles, and for this reason we will only look at the shell from an interactive
stand-point. If you do want to get into shell programming, there are many books
available on the subject!
Before we get started with how to maneuver around your system with a shell,
we need to get several things out of the way first. When the powers that be
created Unix, they had a certain idea, or goal, about how it should work. This
is loosely referred to as the "Unix philosophy". It can be summed
up in the simple phrase: "Small is beautiful". The philosophy has
grown from the UNIX community instead of being forced upon it. According to
Mike Gancarz, in ``The UNIX Philosophy'', there are 9 major ``tenets'' of the
Unix philosophy. Several are significant to your understanding of how to make
the most out of your FreeBSD system:
1. Small is beautiful
2. Make each program do one thing well
3. Make every program a filter
The idea here is that small programs are simple, and therefore easier to understand.
A natural side effect is that a program should only do one thing - if you want
more than one thing done, you just connect different individual programs to
accomplish your task. That's where filters (also referred to as pipelines) come
into play. Every program is a filter in the sense that it produces an output
given an input. The output of one program can be fed into the input of another
program, and vice verse. You will see what I mean once we get to some concrete
examples in the next section.
FreeBSD is a sophisticated, multi-user, multi-tasking operating system. It's
not DOS. You can't simply ``power off'' with the power button on your PC without
first telling FreeBSD that you wish to shutdown. If you want to know why, continue
reading. Otherwise, just skip ahead to the next paragraph for the necessary
commands. When your FreeBSD system is up and running, it goes through a lot
of measures to optimize performance. One of the biggest ways to optimize performance
is through the use of ``buffers''.
When you read or write to the disk, data is moved into and out of buffers. You
can think of buffers as buckets. Lets say I have a hose running, and it only
reaches so far. Unfortunately, I'm still 5 meters away from my pool, and I need
to get water into the pool. Obviously, it's not very efficient for my to take
one glass of water at a time from the hose over to the pool. I'd use a bucket
- or more precisely, I'd place the bucket under the hose, and when the bucket
fills up I'd dump it into the pool. Get it? The FreeBSD equivalent is: it's
slow to write to the disk, so I want to minimize the trips I have to make to
the disk. So when I'm writing a file, I place the information I need into buffers
until I have enough to make it worth while to go and visit that slow old hard-disk.
Then I can write everything out at once. Since buffers are stored in RAM, if
you just cut the power to your computer, there is a chance that some of the
information you thought you wrote to the disk never actually made it there!
And that would be crappy. As it turns out, FreeBSD (actually, the filesystem
FreeBSD uses) ``syncs'' data from the buffers out to the hard disk every 30
seconds - but even then there is no guarantee that sync will move it to the
disk right away.
If the system is under low load (a measure of how busy the CPU is - usually
very low on a workstation, but it could be quite high on a multi-user server)
then it's unlikely that data will be sitting in a buffer for more than a couple
of seconds. So, you need to tell FreeBSD to take whatever is sitting buffers
and dump it to the disk. Hence, the shutdown command. It slices, it dices, it
sync's, and it notifies! What more could you ask for?
To shutdown FreeBSD, you use the shutdown command! Depending on what arguments
you give it, it will behave differently. For example:
shutdown -h now Tells FreeBSD to shutdown, halt the CPU, and do it now.
shutdown -r now Tells FreeBSD to shutdown, and then reboot the system. Do it
now.
reboot Does the same as shutdown -r now.
When you do the shutdown command, a broadcast message will be sent to all users
currently logged in that the system is going down. Instead of ``now'' you could
say shutdown -h +5 which will bring the system down in 5 minutes. Every minute
FreeBSD will send a broadcast message to all users warning of the impending
shutdown. If you just want to kick everyone off, shutdown -k now will do so,
and will also prevent anyone else from logging in!
In summary, using the FreeBSD shutdown command is not only the ``safe'' way
to stop your system, but also the ``friendly way'' :-)