Pages

FreeBSD For Beginners

If operating systems were ski runs, Linux would be a relatively challenging blue. Get ready for the BSD red run.

Any operating system that contains the letters B, S and D usually conjures images of geeky elitism, arcane interfaces and the undead world of UNIX. Despite its similarity, this is an image Linux has largely been able to shake off, thanks to its friendly graphical installers and configuration tools. But BSDs can offer a unique insight into what has made Linux popular, as well as an opportunity to hone your command-line and trouble shooting skills in a world that might be getting too easy. And while you do need a little technical confidence to get any BSD system up and running, it's not half as difficult as it first appears.
FreeBSD is not as demonic as its logo might suggest. Honest.
FreeBSD is a the most popular implementation of version 4.4 of the Berkeley Software Distribution. This was the original BSD, a version of UNIX that was developed between the late-70s and the mid-90s and used a famously liberal licence. This licence has meant that anyone can use, copy and redistribute and re-implement its code and APIs. Which is exactly what FreeBSD attempts to do, alongside other projects like OpenBSD and NetBSD. In turn, there are many projects like Apple’s OS X that build upon the foundations in FreeBSD, all thanks to the liberal licences of the original.


Step 1: Prologue

There are several important differences between FreeBSD and Linux, but the most fundamental is the kernel. The term ‘Linux’ is most often used to refer to the entire operating system, from the boot code and drivers to the desktop and the applications. We’d call Ubuntu, Fedora and OpenSUSE different versions of Linux, for instance. But this definition isn’t accurate. ‘Linux’ should only really refer to the kernel - the chunk of code at the heart of the system that deals with hardware, networking, drivers, storage, CPU and process management, and the BSD kernel is entirely different.
The Linux kernel that was originally developed by Linus Torvalds, and it’s still the only part of the whole operating system he has control over. The remainder of what makes a complete operating system, the windowing environment, the desktops and the applications, are pulled from open source project that are mostly using one of the the GNU Public Licences. Hence, the official name for the entire Linux operating system is really GNU/Linux to show that there are two parts of the whole project. Which is why replacing the kernel isn’t a trivial operation.
Don't be scared of text mode. It's part of Linux's legacy, and serves a very useful purpose.
Any new kernel needs to be broadly compatible with Linux so that the remainder of the software stack can be ported without too much difficulty. Fortunately, both FreeBSD and Linux are UNIX-alike, which means there are many similarities, and the result is that with a standard installation, you'll find many of the tools you're already familiar with, albeit in a different configuration.
Many system administrators feel FreeBSD is has been a more stable choice for servers over the years, and that it can out-perform its cousin on certain tasks. It's also a great choice if you want to run a server on limited hardware, as the requirements for a BSD-based system are often less than for the Linux equivalent. FreeBSD, for example, lists its minimum requirements as a 486 CPU with 24MB RAM, which is quite staggering in today's world of terabytes and quad core processors. FreeBSD is also a i386-based platform. There are ports to other processors, but the project's focus has always been compatibility with Intel's standard architecture, and as a result, could be better suited to the majority of machines that parts of the Linux kernel.

Step 2: Installation

While there are Live CD versions of FreeBSD, the traditional install disc is still the most common medium for getting hold of the latest version. But you'll need to steel yourself against its antiquated installation mechanism.
When you boot your machine with the disc in the drive, the first thing you’ll see is the black and white ASCII art of the install menu. You won't see any other graphical embellishment until you're able to boot successfully into a working desktop. For most installs, you’ll need to choose option 1 from the menu, but if you’re using an older machine, you may want to try 2 (with ACPI disabled) to avoid any potential problems.
Unlike trial Linux installation packages like Wubi, installing BSD has a tendency to be destructive. Make sure you're not going to obliterate anything important before continuing.
You’ll then have to wait a few moments while various kernel messages scroll by before you’ll see the text-based installation and configuration screen. If you’ve used Debian, this kind of text installer will feel familiar. There's no linearity to the install process. You can move backwards and forwards through the various options, and continue to make adjustments to the installation until you quit the installer and restart the system.
For a basic, working environment, you will need to do at least the following. Select the second option in the menu to initiate a ‘Standard Install’ and read the information on the screen that follows. The next page displays ‘fdisk’, the disk partitioning and formatting tool. Press F1 for documentation, but if you’re using your entire hard drive for this installation, press ‘a’ to select everything, followed by ‘q’ to apply the changes. This will delete everything currently on the drive, so be careful.
The next page will ask if you want to install a boot loader, which is the menu that lets you choose between whatever operating systems you have installed. Choose the second option (BootMGR), and on the following page, you need to create the various partitions used by FreeBSD using the same fdisk-like interface we've just seen.
Once again, if you're using an entire drive for the installation, you can just press ‘a’ to let the installer create the most appropriate array of partitions followed by ‘q’ to make the changes permanent.
The next page will ask you to choose a distribution. Unlike a Linux distribution, FreeBSD uses the term to refer to the default selection of packages that are to be installed. Select 'Custom' and add 'base' and 'kernels > GENERIC' to your installation.
This will give you enough package to get a working system, and we'll need to add the desktop environment at a later stage. Return to the 'Exit' option at the top of the list and press space to jump into the package installation routine.

Step 3: Post-Install

After all the preliminary configuration has completed, you’ll be asked whether you want to configure any Ethernet or SLIP/PPP devices. Select ‘Yes’ if you are connecting to the internet through your machine’s ethernet port, and you should see your adaptor listed in the top of thew connections list. Choose the adaptor, say no to IPV6, say yes to DHCP and skip through the configuration page to the OK button. Say 'no' to your machine being a network gateway,'no' to enabling any inetd services or running SSH, FTP and NFS server and clients, and don't edit the console settings. You can safely setup a timezone for your machine and enable the PS2 mouse emulation if you're using one.
Don't worry too much about your initial selection of packages. You can easily add more later.
Say 'Yes' to the next question, and you'll now be looking at the package manager. This is where you choose what applications you want to be installed on top of the default option we chose earlier, and there are thousands of packages to choose between. For a simple setup, jump into the ‘x11’ menu and select the 'kde4-4.3.1' package. It's exact name will depend on the version of FreeBSD you’re playing with. If you’re not a fan of Gnome, you could also choose ‘gnome2-2’ from the same list of packages. Selecting either will also mark their dependencies for installation. You also need to select xorg-7, and any other packages you know you're going to need.
When you’re ready to go, jump back to the top package list, select ‘Install’ and press space. You’ll need to wait a while for all the packages to install. The next step is to create a user account. You can do this by saying 'Yes' to the option, then selecting 'Add User', and entering a user name in the page that follows. Select OK to make the change permanent and exit from the users and groups menu. You'll then be asked for the system manager's password, and you'll need to type this twice.
After that, you can say ‘No’ to the post-install configuration request and wait for your machine to reboot. You're now at the point where you should have a basic, working installation, and you can quit from the installation menu and restart your system.

Step 4: Configuration

When your machine re-appears, you'll be greeted by the sombre monochrome of the command line. Login as 'root' with your system manager's password. For both Gnome and KDE, you need to add the following two lines to the '/etc/rc.conf' configuration file:
dbus_enable="YES"
hald_enable="YES"
Unfortunately, you're going to need to use the 'vi' text editor. Type 'vi /etc/rc.conf' to load the file. Press 'i' to enter insert mode, move to a new line and type the following. Press escape to exit insert mode, followed by ':wq' (without quotes) to save the changes and quit the editor. Next type 'reboot' to restart your system.
FreeBSD doesn't come with a desktop activated by default, but it's simple enough to change.
When you get back to the login screen, enter your user account details this time, and when you get dropped back to the command line, type 'vi .xinitrc' and add the following line to the file:
exec /usr/local/kde4/bin/startkde4
This is telling your system that when the X.org graphical system starts, you want KDE to be used as your desktop environment. Save and exit vi.

Step 5: Launch Desktop

Usually, at this point, you need to create an 'xorg.conf' file to define the display properties for your machine. But recent releases of the X server are able to create a working configuration without any further editing. Which means typing 'startx' is all you need to do to launch a graphical environment running KDE. If this doesn't work, then you will need to create create a working /etc/X11/xorg.conf file.
But with FreeBSD 8, it's more likely that you are now looking at KDE running through its Akanadi porting routines as it builds up a configuration for your desktop. After a couple of minutes, this will leave you with a KDE desktop running on-top of FreeBSD, and you've just earned another trophy for your awards cabinet.
At long last: a GUI! And one of the more stable interfaces you'll find. Here's hoping BSD serves you well.
This is exactly the same KDE you'll find on Linux, and you'll be hard pressed to find any difference between the way it works on FreeBSD and the way it works with Kubuntu. It's only when it comes to system configuration that you'll notice because FreeBSD doesn't have any graphical configuration tools, which means if you need to change anything, you've got to be prepared to go back to the command line. But that's another story.

See also: PC-BSD 8.0

If you've followed the main text to install a shiny new version of FreeBSD, you might have noticed that the install mechanism really wasn't all that shiny or new. It reality, it feels ancient. But this doesn't mean that the operating system has been languishing unloved and undeveloped, it just means that making the installer easier to use is low on the priority list.
Fortunately, this being open source, demand for a better way of doing things has led to several alternatives, the best of which is PC-BSD, which you’ll find at www.pcbsd.org. It does several impressive things. Firstly, it replaces the tepid monochrome installer of FreeBSD with a graphical application much-more in-line with its Linux counterparts. It will also automatically install and configure a recent version of the KDE desktop, which should mean you can get productive with a FreeBSD system as quickly as possible, without touching the command line, and there's a wonderful wiki full of helpful documentation.
This means you can install PC-BSD by placing the disc in the drive, rebooting your machine, answer the questions that appear and wait for the operating system to install. You won't even need to worry about manually partitioning your drive unless you want to create a custom configuration.
Another important difference is that it PC-BSD doesn't use the same package management as FreeBSD, although you can still get to it if you need to. Instead, package are available as single files with the '.pbi' file extension, which can then me installed with a simple click. It's more like how packages are handled on OS X, and is far better than the weird world of dependencies you find on Linux.

 For More Check Related Links :

0 comments:

Post a Comment