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

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.

FreeBSD1.jpg



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.

FreeBSDmain.jpg

Hit Enter on your keyboard to boot FreeBSD for installation.

FreeBSDboot.jpg

FreeBSD is now booting.

FreeBSD2.jpg

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.

FreeBSD3.jpg

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

FreeBSD4.jpg

Hit "Enter" to partition are hard disk.

FreeBSD5.jpg

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.

FreeBSD6.jpg

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.

FreeBSD7.jpg

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".

FreeBSD8.jpg

Press "Enter" for "OK".

FreeBSD9.jpg

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".

FreeBSD10.jpg

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

FreeBSD11.jpg

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

FreeBSD12.jpg

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

FreeBSD13.jpg

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

FreeBSD14.jpg

Hit "Enter" for YES.

FreeBSD15.jpg

FreeBSD is now beginning the installation.

FreeBSD16.jpg

Installing ports into are FreeBSD installation.

FreeBSD17.jpg

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

FreeBSD18.jpg

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.

FreeBSD19.jpg

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

FreeBSD20.jpg

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

FreeBSD21.jpg

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!

FreeBSD22.jpg

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

FreeBSD23a.jpg

For host you need to type in the hostname of your FreeBSD machine (what you're going to call your machine, we used freebsd.net as an example). For domain you need to enter the name of your domain (your domain name if you have one), for example cars.com, etc. We used freebsd.net 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 "192.168.35.1". 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 192.168.35.10 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.

FreeBSD24.jpg

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

FreeBSD25.jpg

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

FreeBSD26.jpg

Hit "Enter" for NO!

FreeBSD27.jpg

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.

FreeBSD28.jpg

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

FreeBSD29.jpg

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

FreeBSD30.jpg

Hit "Enter" for NO!

FreeBSD31.jpg

Hit "Enter" for NO!

FreeBSD32.jpg

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

FreeBSD33.jpg

Hit "Enter" for NO!

FreeBSD34.jpg

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

FreeBSD35.jpg

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

FreeBSD36.jpg

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.

FreeBSD37.jpg

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".

FreeBSD38.jpg

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

FreeBSD39.jpg

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

FreeBSD40.jpg

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

FreeBSD41.jpg

Hit "Enter" for User.

FreeBSD42.jpg

Fill in the categories to setup your user account.

FreeBSD43a.jpg

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.

FreeBSD44.jpg

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

FreeBSD45.jpg

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.

FreeBSD46.jpg

Hit "Enter" for NO!

FreeBSD47.jpg

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

FreeBSD48.jpg

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:

 su

and enter your root password.

Bash1.jpg

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:

 ls

your screen should look like this:

Bash3.jpg

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:

Bash4.jpg

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:

Bash6.jpg

and

Bash7.jpg

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

 which bash

and your screen should look like:

Bash9.jpg

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

To change to the newly installed bash shell type:

Bash8.jpg

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.

Bash10.jpg

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

Bash11.jpg

Enter your password and your screen should look like:

Bash12.jpg

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.

Bash13.jpg

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:

 ls

Pine.jpg

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:

Pine1.jpg

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:

Pine2.jpg

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

Pine3.jpg

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

Pine4.jpg

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

 exit  

Then check your PINE installation by typing:

 pine

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

Pine5.jpg

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

 q

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

 pico

Your screen should now look like:

Pine6.jpg

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:

 ls

Your screen should now look like:

Apache.jpg

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:

Apache1.jpg

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.

Apache2.jpg

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:

Apache3.jpg

Press Enter on your keyboard and then type:

 make install

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

Apache4.jpg

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

Apache5.jpg

FreeBSD is now beginning to download the apache 2.2 files

Apache6.jpg

When apache has finished installing your screen should look like:

Apache7.jpg

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:

 ls

If apache has been installed your screen should look like:

Apache8.jpg

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.

Apache9.jpg

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:

Apache10.jpg

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

Apache11.jpg

Next, lets start apache by typing:

 /usr/local/sbin/apachectl start

Your screen should now look like:

Apache12.jpg

Apache is now installed and running!!

References

freebsd.org