From OST
Revision as of 17:20, 12 December 2008 by Charpro (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


FreeBSD is a very powerful and stable operating system, it can be tailored to run as a server or workstation. Below are some tutorials on setting up FreeBSD.


Install FreeBSD

This is the first of many tutorials for FreeBSD. In this tutorial we will be doing a basic installation of the operating system itself, FreeBSD.


Hit Enter on your keyboard to boot FreeBSD for installation.


FreeBSD is now booting.


At this screen you need to select the country that you are in. In this case select 232 for United States because we are in the United States for this install.


We are doing a standard installations. So hit "Select" to begin a standard installation.


Hit "Enter" to partition are hard disk.


We now need to partition are disk. You can partition your disk to share space with another Operating System by using the given commands. We are not going to do that in this install. We are gonna use the entire hard disk, therefore we are going to press "A" for Use Entire Disk.


Our screen should now look like this after you have selected "Use Entire Disk". At this point we are down partitioning and need to exit. We press "Q" to Finish.


FreeBSD is now asking if we want to install a boot manager. If you were to have more than one Operating System on your hard disk for a dual boot system, we could install a boot manager for that. In this install we only have FreeBSD, therefore we are going to select "Standard" and press "OK".


Press "Enter" for "OK".


In this screen we need to partition are hard disk for the directories in FreeBSD. Expert users who have knowledge in the directory setup in FreeBSD use other commands to partition the hard disk. In this install we are going to select "A" for "Auto Defaults".


Our screen should now look like this. We are done setting up our FreeBSD directories. Press "Q" to "Finish".


In this screen select "4" for "Developer". This will install Full sources into our FreeBSD system.


We need FreeBSD ports later to install programs and applications, so hit "Enter" for YES.


We are installing FreeBSD from a CD so hit "Enter" for CD/DVD.


Hit "Enter" for YES.


FreeBSD is now beginning the installation.


Installing ports into are FreeBSD installation.


FreeBSD has been installed with ports. Press "Enter" for OK.


At this point we need to setup our Internet connection so we could Secure Shell into our system, access the Internet, etc. Hit "Enter" for YES.


Hit "Enter" for de0, that is our Network Interface Card (NIC), what the ethernet cat5 cable is plugged into.


We are not setting up IPv6 for this install so hit "Enter" for NO!


You can select DHCP if you want FreeBSD to automatically get access to the internet, but for this install we are going to set up a static IP for our FreeBSD system. Hit "Enter" for NO!


We need to setup our static IP by filling in the following categories.


For host you need to type in the hostname of your FreeBSD machine (what you're going to call your machine, we used as an example). For domain you need to enter the name of your domain (your domain name if you have one), for example, etc. We used as an example domain name. The IPv4 gateway is usually the first IP address on your Local Area Network. In this example we are on a 192.168.35 local area network, therefore the gateway is "". Enter the same address for the "Name Server" category. The IPv4 Address is the the address you want your FreeBSD system to sit on in your Local Area Network. We selected as an example in this local area network. (You can pick any **un-occupied** address in your local area network.) Hit "Enter" for OK when you have filled out all the categories.


To start our connection hit "Enter" for YES at this point.


For this install we aren't using FreeBSD as a router or gateway to the internet, so hit "Enter" for NO!


Hit "Enter" for NO!


Hit "Enter" for YES. We want to be able to Secure Shell into our FreeBSD from another machine in order to install and setup FreeBSD as a Webserver, etc.


We aren't going to setup anonymous FTP on this install, so hit "Enter" for NO!


Hit "Enter" for NO! We're not gonna setup NFS at this time.


Hit "Enter" for NO!


Hit "Enter" for NO!


Hit "Enter" for YES to setup our systems Time Zone.


Hit "Enter" for NO!


We need to select the region we are located in, "America".


Select "47" for "United States" and hit "Enter" for OK.


For this install we are in Mountain Time, if you are on the east coast or west coast you would select the appopriate time zone for your location.


This screen asks if you want to run Linux binary compatibility so you can run Linux applications. This is entirely up to you, for this install we selected "NO".


We are going to run our FreeBSD system headless (no monitor) and secure shell into it so hit "Enter" for NO!


For this install we are going to install applications via ports later, so hit "Enter" for NO!


We need to setup a user so we can secure shell or login into our system, so hit "Enter" for YES!


Hit "Enter" for User.


Fill in the categories to setup your user account.


For this install we used a made up user to walk you through this step. Our username is going to be "Joe" (Login ID), he is in the "wheel" group so we can elevate ourself to "Root" for administrative priviledges, enter a password for the user, "Joe Schmoo" for Full Name, "staff" for Member Groups, then hit "Enter" for OK.


Select "Exit" and hit "Enter" to exit.


Hit "Enter" for OK. And you will prompted to enter a password for "Root" in order to do get administrative priviledges on your FreeBSD system.


Hit "Enter" for NO!


Select "Exit Install" and hit "Enter" to exit install.


Hit "Enter" for YES! Make sure you take out your FreeBSD CD out of your CD/DVD drive. Congrats you now have installed FreeBSD!!

Install BASH shell

When we first installed FreeBSD we didn't install the BASH shell as our default shell. This tutorial will walk you through the process of installing BASH as your default shell.

Login into FreeBSD with your user account. Once your logged into FreeBSD make sure and log in as "root", when doing installations under FreeBSD you need to be root in order to install programs and applications. So log in as root by typing:


and enter your root password.


Enter your password for root. Next you must navigate to the /usr/ports directory. The /usr/ports directory has a listing of applications and programs that can be downloaded and installed.

So, navigate to the /usr/ports directory by typing:

 cd /usr/ports

and for a listing of the contents in the directory type:


your screen should look like this:


As you can see the applications and programs are seperated in categories. The BASH shell would be in the category shells. Now lets navigate to the category/directory shells by typing:

 cd shells

and type ls for a listing of the contents in the directory shells. Your screen should now look like this:


Installing programs and applications is fairly easy under FreeBSD. Just navigate to /usr/ports and find the program/application you wish to install, navigate to that directory, in this case bash and type make install. So to navigate to bash type:

 cd bash

and then type:

 make install

your screen should now look like:




When bash is finished installing, check to see if its installed by typing:

 which bash

and your screen should look like:


You might have to log out of root first if no result is shown!

To change to the newly installed bash shell type:


To change your default shell to bash we need to do the following:

 chsh -s /usr/local/bin/bash username

Your terminal should look like the following, **NOTE** I added my own username, so add your FreeBSD username.


You might be prompted for a password if you change your default shell without being logged in as root.


Enter your password and your screen should look like:


Now lets check to see if our default shell is bash by typing:

 grep username /etc/passwd

Your screen should produce a similar result: **NOTE** I replaced username with my username cpro.


As you can see at the end of the entry my default shell is bash = /usr/local/bin/bash! Now everytime you log in you will be working in the BASH shell!!

Install PINE and PICO

In this tutorial we will install PINE so we can send and receive mail, also PICO for a text editor. PICO comes as a package in PINE. For those who aren't familiar with the default vim and ee text editors PICO is a good text editor to use. **NOTE** When installing applications/programs make sure you are logged in as root!

Just like installing BASH we navigate to /usr/ports by typing:

 cd /usr/ports

then to see a listing of the directories type:



Pine is located in the mail directory so to navigate to the mail directory type:

 cd mail

and then type ls for a listing. **NOTE** The listings are big in this directory so to browse the listing line by line type:

 ls | more

and then you will be able to browse down the list line by line by pressing the space-bar until you find pine. When you find pine, in this case it's pine4 you should see this:


at this point press q on your keyboard to get a command line and then type:

 cd pine4

then type:

 make install

which will begin the installations of PINE. You will now see this:


Make sure you have PICO checked, then press OK. Your screen should now look similar to this:


Press Enter on your keyboard for YES. You will then start the download and installation process.


When download and installation is finished log out of root by typing:


Then check your PINE installation by typing:


Hit the Enter key on your keyboard for the first prompts and you should get the following:


You now have PINE installed! Next lets check to see if PICO has been installed. Lets exit out of PINE by typing:


We are now back to a commandline. We can now check if our text editor PICO has been installed by typing:


Your screen should now look like:


We now have PINE for mail and PICO for text editing installed on our FreeBSD system!! whoo hooo....

Install Apache 2.2 for a Webserver

In this tutorial we will install Apache 2.2 to serve as a Webserver on our FreeBSD system. First of all, we need to navigate to the /usr/ports directory. **NOTE** Remember to log in as root when doing installations! Type:

 cd /usr/ports

Now, to see a listing type:


Your screen should now look like:


Apache 2.2 will be under the www directory. The www directory is the directory for applications related to the internet. To navigate to the www directory type:

 cd www

Your screen should now look like:


Press Enter on your keyboard. This directory is fairly large, so we must look at it line by line to find apache22. Do this by typing:

 ls | more

Press the Space-Bar to navigate down until you find apache22.


Once you find apache22 press Q on your keyboard to get back to the commandline. Then navigate to apache22 directory by typing:

 cd apache22

Your screen should now look like:


Press Enter on your keyboard and then type:

 make install

This will start the download and installation. Your screen should now look like this:


Press Tab and Enter on your keyboard for OK. Your screen should now look like:


FreeBSD is now beginning to download the apache 2.2 files


When apache has finished installing your screen should look like:


Let's check if apache has been installed in our system by navigating to it's directory. To navigate to apache's directory type:

 cd /usr/local/www

Then to show if its in the www directory type:


If apache has been installed your screen should look like:


Next, we will add a comment in the rc.conf file so apache will automatically start when your system is rebooted or started. In your command line type:

 echo 'apache22_enable="YES"' >> /etc/rc.conf

Then press Enter on your keyboard.


Now, lets check the rc.conf file and see if our comment was added by typing the following:

 pico /etc/rc.conf

Your screen should now look like:


It appears that apache22_enable="YES" has been added to the rc.conf file.


Next, lets start apache by typing:

 /usr/local/sbin/apachectl start

Your screen should now look like:


Apache is now installed and running!!