the freebsd compact reference guide

35
The FreeBSD Compact Reference Guide Second Edition Written By David Childers

Upload: scenicradio

Post on 18-Nov-2014

116 views

Category:

Documents


5 download

DESCRIPTION

A concise reference guide for the average FreeBSD user.

TRANSCRIPT

Page 1: The Freebsd Compact Reference Guide

The FreeBSDCompact Reference

Guide

Second Edition

Written ByDavid Childers

Page 2: The Freebsd Compact Reference Guide

The FreeBSD Documentation License

Redistribution and use in source (SGML DocBook) and 'compiled' forms (SGML, HTML, PDF, PostScript, RTF and so forth) with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code (SGML DocBook) must retain the above copyright notice, this list of conditions and the following disclaimer as the first lines of this file unmodified.

2. Redistributions in compiled form (transformed to other DTDs, converted to PDF, PostScript, RTF and other formats) must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Important: THIS DOCUMENTATION IS PROVIDED BY THE FREEBSD DOCUMENTATION PROJECT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD DOCUMENTATION PROJECT BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. www.freebsd.org/copyright/freebsd-doc-license.html

Creative Common License

This body of work is released under the Attribution-ShareAlike version 3.0, Creative Common License.

The work may be freely distributed or modified for commercial or non commercial purposes.

If this work is modified, compliance with the Attribution-ShareAlike version 3.0, Creative Common License is required.

These requirements include:

- Any derivatives of this work must be attributed to David Childers. - Alterations, transforming, or building upon this work requires distributing the resulting work only under the same, similar or a compatible license.

For the complete legal code, please refer here: www.creativecommons.org/licenses/by-sa/3.0/legalcode Cover graphic - This picture was taken from the Dictionnaire encyclopédique Trousset, also known as the Trousset encyclopedia, Paris, 1886 - 1891. www.oldbookillustrations.com/pages/vignette1.php?lng=en Foreword graphic - This picture was taken from “Safe Counsel: Searchlights on Health: Light on Dark Corners” (1896)www.fromoldbooks.org/pictures-of-old-books/pages/cimg5129-rose-on-music-book-on-piano/800x600-q85.html#details

Page 3: The Freebsd Compact Reference Guide

About The Author David Childers is the Content Manager and Senior Editor for the International Broadcasting portal www.BroadcastingWorld.net. He is also the webmaster of the SHOUTcast video streaming information resource, www.scvi.net. He is very active in the Internet broadcast industry. Mr. Childers' work has been cited in several national and International publications, such as: Five Essays on Copyright In the Digital Era Turrer Publishing Research On High-Profile Digital Video Production Digital Content Association of Japan Video Podcasting in Perspective: The History, Technology, Aesthetics and Instructional Uses of a New Medium Journal of Educational Technology Systems Video Podcasting: When, Where and How it's Currently used for Instruction The National Convention of the Association for Educational Communications and Technology IP Packet Charging Model For Multimedia Services National University of Rwanda Preservation of audiovisual mediums : Problems and challenges. Platform for Archiving and Preservation of Art on Electronic and Digital Media. P2P Technology Trend and Application to Home Network Electronics and Telecommunications Research Institute Journal Peer To Peer Computing - The Evolution of a Disruptive Technology Idea Group Publishing Peer-to-Peer Systems and Applications Lecture Notes In Computer Science Springer Berlin / Heidelberg Mr. Childers has also written several guides including: Easy Gnome Desktop Installation Script For FreeBSD www.scribd.com/doc/27366469/Gnome-Desktop-Installation-Script-For-FreeBSD

Gibraltar FreeBSD Hardening Scriptwww.scribd.com/doc/33631895/Gibraltar-FreeBSD-Hardening-Script

SHOUTcast Streaming Best Of Technical Support www.scribd.com/doc/24188933/SHOUTcast-Streaming-Best-of-Technical-Support

SHOUTcast Audio And Video Streaming Guide www.scribd.com/doc/19781412/SHOUTcast-Audio-And-Video-Streaming-Guide

Icecast Streaming Handbook www.scribd.com/doc/18175026/Icecast-Streaming-Handbook

Streaming Media Handbook www.scribd.com/doc/16272608/Streaming-Media-Handbook

Basic Internet Video Production Guide www.scribd.com/doc/41446946/Basic-Internet-Video-Production-Guide

Page 4: The Freebsd Compact Reference Guide

Foreword I have updated and expanded this guide so that it continues to remain a valuable resource for the FreeBSD community.

There are numerous publications available for the FreeBSD enthusiast, and you can fill a library with Unix reference publications as well. However, there are no readily available compact reference guides for the typical FreeBSD user. As a contribution to the FreeBSD and Open Source movement, I have attemtped to provude such a guide. I would like to thank Scarlet Coker for providing assistance with the editing of the manuscript and James Davey at Broadcasting World for allowing me the opportunity to create this guide. It is my sincere hope that the reader finds this reference guide beneficial. David Childers www.scvi.net May 2011

Posveèeno Neži Vidmar.

Pri veri se ne gre za vprašanje ali Bog obstaja ali ne. Gre se za to, da verjamemo, da je ljubezen brez plaèila prav tako dragocena.

If you have any trouble sounding condescending, find a Unix user to show you how it's done.

Scott Adams

Page 5: The Freebsd Compact Reference Guide

Please Donate If you find this guide useful, please consider making a small donation to show your appreciation of my work. https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=10870717

Page 6: The Freebsd Compact Reference Guide

Index - Directory Structure

- System Configuration Files

- Memory Devices

- Man Pages

- System Information Commands

- Common Commands

- Packages And Ports

- Adding Hardware

- Network Card

- Sound Card

- Wireless Networking

- Webcam

- Common UNIX Printing System

- Binary Operating System Compatibility

- Linux Compatibility Configuration

- Windows Compatibility Configuration

- Software

- References

Page 7: The Freebsd Compact Reference Guide

Directory Structure

Directory / /bin/ /boot/ /boot/defaults/ /dev/ /etc/ /etc/defaults/

/etc/mail/ /etc/namedb/

/etc/periodic/

/etc/ppp/ /mnt/ /proc/ /rescue/ /root/ /sbin/ /tmp/ /usr/ /usr/bin/ /usr/include/ /usr/lib/ /usr/libdata/ /usr/libexec/ /usr/local/

/usr/obj/ /usr/ports/

/usr/sbin/

Description Root directory of the file system. User utilities fundamental to both single-user and multi-user environments. Programs and configuration files used during operating system bootstrap. Default bootstrapping configuration files. Device nodes. System configuration files and scripts. Default system configuration files. Configuration files for mail transport agents. Named configuration files. Scripts that are run daily, weekly, and monthly, via cron. ppp configuration files. Empty directory commonly used by system administrators as a temporary mount point. Process file system. Statically linked programs for emergency recovery. Home directory for the root account. System programs and administration utilities fundamental to both single-user and multi-user environments. Temporary files. The contents of /tmp are usually NOT preserved across a system reboot. A memory-based file system is often mounted at /tmp. This can be automated using the tmpmfs-related variables of rc.conf (or with an entry in /etc/fstab). The majority of user utilities and applications. Common utilities, programming tools, and applications. Standard C include files. Archive libraries. Miscellaneous utility data files. System daemons & system utilities (executed by other programs). Local executables, libraries, etc. Also used as the default destination for the FreeBSD ports framework. Within /usr/local, the general layout sketched out by hier for /usr should be used. Exceptions are the man directory, which is directly under /usr/local rather than under /usr/local/share, and the ports documentation is in share/doc/port. Architecture-specific target tree produced by building the /usr/src tree. The FreeBSD Ports Collection (optional).

System daemons & system utilities (executed by users).

Page 8: The Freebsd Compact Reference Guide

/usr/share/ /usr/src/ /usr/X11R6/ /var/ /var/log/ /var/mail/ /var/spool/ /var/tmp/ /var/yp/

Architecture-independent files. BSD and/or local source files. X11R6 distribution executables, libraries, etc (optional). Multi-purpose log, temporary, transient, and spool files. A memory-based file system is sometimes mounted at /var. This can be automated using the varmfs-related variables of rc.conf (or with an entry in /etc/fstab). Miscellaneous system log files. User mailbox files. Miscellaneous printer and mail system spooling directories. Temporary files. The files are usually preserved across a system reboot, unless /var is a memory-based file system. NIS maps.

This information used by permission via the FreeBSD Documentation License. Copyright 1994-2009 The FreeBSD Project. All rights reserved.

Page 9: The Freebsd Compact Reference Guide

System Configuration Files List of the most common system configuration files /boot/loader.conf This file contains information for bootstrapping the system. The following attributes can specified: * The kernel to be booted. * Parameters to be passed to the kernel. * Additional modules to be loaded by the kernel. * Generally sets all variables described in loader. /etc/fstab This file contains descriptive information about the various file systems. /etc/ftpusers This file contains a list of users that may not log in using the File Transfer Protocol (FTP) server daemon. /etc/group This file defines the groups on the system. The following attributes can be specified: * group_name - The name of the group. * password - The (encrypted) group password. * GID - The numerical group ID. * user_list - A list of the member usernames of this group. /etc/hosts This file contains information that associates IP addresses with hostnames. /etc/hosts.allow This file contains the names of the hosts which are allowed to use local resources. /etc/hosts.equiv This file contains the names of trusted remote hosts and users. /etc/hosts.lpd This file contains a list of hostnames or IP addresses that are allowed to use local print services. /etc/inetd.conf This is the default configuration file for the inetd (super-server) daemon. /etc/login.access This file specifies (user, host) combinations and/or (user, tty) combinations for which a login will either be accepted or refused.

/etc/login.conf This file contains various attributes and capabilities of login classes. A login class (An optional annotation against each record in the user account database, /etc/master.passwd) determines session accounting, resource limits and user environment settings which are specified.

Page 10: The Freebsd Compact Reference Guide

/etc/make.conf

This file contains system-wide settings that will apply to every build using make and the standard sys.mk file. /etc/newsyslog.conf This file is used to set log file rotation configuration for the newsyslog utility. /etc/rc.conf This file contains descriptive information about the local host name and configuration details for any potential network interfaces. It also specifies which services should be started at the system initial boot time. /etc/ssh/sshd_config This file contains configuration information for the OpenSSH SSH daemon. /etc/sysctl.conf This file contains values to be read in and set by sysctl. /etc/syslog.conf This file contains configuration information for the syslogd program. /etc/ttys This file contains information that is used by various routines to initialize and control the use of terminal special files.

Page 11: The Freebsd Compact Reference Guide

Memory Devices Disk d evice c odes Code ad da acd cd fd

Device ATAPI (IDE) disk SCSI direct access disk ATAPI (IDE) CDROM SCSI CDROM Floppy disk

External m ounted d evice To enable device auto mount, the HAL daemon must be initialized when the computer is started. HAL provides a hardware abstraction layer. Its purpose is to allow desktop applications to discover and use the hardware of the host system, regardless of the type of hardware. Steps to initialize this process: Edit the /etc/rc.conf file: # nano /etc/rc.conf The following line needs to be added to the /etc/rc.conf file: hald_enable="YES" This command can be used to verify that the attached device is present:# dmesg CD / DVD(Ver 8.0 and above)

Enable:# mkdir /media/cdrom # chmod 660 /dev/acdo

Mount:# mount -t cd9660 /dev/acd0 /media/cdrom

USB

The USB storage device needs to be accessible by the user.

Edit the /etc/devfs.rules file:#nano /etc/devfs.rules

Add this line to the /etc/devfs.rules file:[localrules=5] add path 'da*' mode 0660 group operator

Enable devfs.rules.

Edit the /etc/rc.conf file:# nano /etc/rc.conf

Page 12: The Freebsd Compact Reference Guide

Add this line to the /etc/rc.conf file:devfs_system_rulese t="localrules"

Allow regular users to mount file systems.

Edit the /etc/sysctl.conf file:# nano /etc/sysctl.conf

Add this line to the /etc/sysctl.conf file:vfs.usermount=1

Create directory where the file system is to be mounted. The user needs to own the directory where the file system is to be mounted.

# mkdir /mnt/username # chown username:usergroup /mnt/username

Page 13: The Freebsd Compact Reference Guide

Man Pages

These are resource documents that provide extensive information regarding commands and applications. This information is preinstalled on almost all Unix and Unix-like operating systems.

The Unix command used to display the individual pages is:# man commandor # man application

FreeBSD Man pages can also be accessed online: www.freebsd.org/cgi/man.cgi

Page 14: The Freebsd Compact Reference Guide

System Information Commands

Hardware c onfiguration List kernel configuration parameters at runtime. # sysctl -a The -a option displays all values currently available. Detect and display the installed hardware. (This file is usually a snapshot of the buffer contents taken after file systems are mounted at startup time. It is not modified till system is rebooted.) # cat /var/run/dmesg.boot Diagnostic utility for the PCI bus. # pciconf -l The -l option lists all devices found by the boot probe. Configure the kernel-resident network interfaces. # ifconfig -a The -a option displays all interfaces which are currently available. Add d evice w ithout r eboot CAM subsystems. This utility provides the user with access and control of the FreeBSD CAM subsystem. Improper use of this utility can cause a loss of data and/or system crashes. # camcontrol Ata subsystems. This utility provides the user with access and control of the FreeBSD ata subsystem. (ATA device driver control program.) # atacontrol Kernel modules. This utility loads file.ko files into the kernel using the kernel linker. # kldload [Name of kernel module to be loaded.] Summary o f c ommands t o o btain h ardware i nformation Determine the hardware type/platform. # uname -m Determine the machine processor architecture. # uname -p Determine FreeBSD release level. # uname -r Obtain all the information at one a time. # uname -mrs Example output: FreeBSD 8.0-RELEASE i386 Determine CPU information, such as speed, make etc. # dmesg | grep CPU

Example output: CPU: Pentium 4 (1716.41-MHz 686-class CPU) acpi_cpu0: on acpi0 acpi_cpu: CPU throttling enabled, 8 steps from 100% to 12.5%

Page 15: The Freebsd Compact Reference Guide

Determine the real and available memory in FreeBSD. # dmesg | grep memory Example output: real memory = 201326592 (192 MB) avail memory = 188555264 (179 MB) Determine how long a computer has been running. # uptime Determine when a computer was last rebooted or shutdown. # last -1 reboot # last -1 shutdown Determine swap file system usage. # swapinfo -k Determine when a specific user was last logged in. # last [user-name] user-name is the login of the user you are inquiring about.

Page 16: The Freebsd Compact Reference Guide

Common Commands System r elated List who is logged into the system. # w List who is logged into the system and where they are logging in from. # who List your current processes within the system. # ps -u [user-name] user-name is the login name of the user. Kill (ends) process with a specified ID. This command works only for your own processes. # kill PID [process number] List commands that have recently been executed. # history Exit from the login shell and terminate session. # logout Exit from any shell. # exit Find the location of a program. # whereis [program name] List current jobs running on the computer and their status. # jobs Login Add a user or group to the computer. # adduser [name] Remove a user from the computer. # rmuser [name] Change your current password. # passwd Add users to wheel group (For SU). # pw user mod user name -G wheel # groups user-name user-name is the login name of the user you want to add.

Gaining access to FreeBSD file system using single user mode .- Boot system- Start single-user mode- Execute the following commands to access the file system.# fsck -p # mount -u / # mount -a -t ufs

Disk Display current disk free space. # df

Page 17: The Freebsd Compact Reference Guide

Display disk usage. # du Display how much disk space has been used. # quota

Printer

Remove a print job from a print queue. # lprm Check the status of a print queue. # lpq General Look up a word in an electronic version of Webster's dictionary and display the definition(s) . # webster [word] Show the current date and time. # date Show a calendar of the current month. # cal Use e.g., 'cal 10 2009' to get that for October 09, or 'cal 2009' to get the whole year. Display the contents of the filename that is specified. This command displays the file, one screen at a time. # cat [filename] Example: # cat ~/var/log/messages Create a copy of source-file with the name target-file. You can specify pathnames as part of the file specification. If target-file exists it is overwritten. # cp [source-file] [target-file] Example: # cp index.html ~/www/htdocs/index.html Find lines in files that match specified text patterns. You can specify pathnames as part of the file specification. # grep [pattern] [filenames] Example: # grep href *.html Directory Change your current working directory to the directory you specify. # cd [directory] Example: # cd ~/www/htdocs Display your current (or present) working directory. # pwd List the files in the directory specified, or the current directory you are in. You can also add additional arguments to customize the list display. # ls [directory] [option]

Options: - The -f option will append a forward slash to the subdirectory names so you can easily distinguish them from file names. - The -a option will show all hidden files. Hidden files begin with a dot (.), such as .htaccess files. - The -l option will show detailed information about each file and directory, including permissions, ownership, file size, and when the file was last modified.

Page 18: The Freebsd Compact Reference Guide

Create a new directory with the name, that you specify. # mkdir [directory_name]

Remove a specific directory. # rmdir [directory_name]

File Determine file type. # file [name of file] Find files anywhere on the computer. # ff -p The -p option allows you to use just the beginning of the file name Change the read, write, and execute permissions on files. # chmod [options] file_name Basic chmod options are: (Class Operation Mode, no spaces inbetween) Class u The user who owns the file. g The group the file belongs to. o The other users. a All of the above. Operation + Adds the mode to the specified class. - Removes the specified mode from the specified class. = The modes specified are to be made the exact modes for the specified class. Mode r Permission to read the file. w Permission to write or delete the file. X Permission to execute the file. Move file to a new location. The pathname can be specified as part of the command specification. If the target-file exists, it is overwritten. # mv [source-file] [target-file] Example: # mv ~/www/htdocs/index.html ~/www/vhosts/mydomain/index.html Rename file. # mv old_file_name new_file_name Delete (removes) a file. To remove a directory and everything inside, you can use the -r (recursive) flag (e.g. rm -r filename). The pathname can be specified as part of the file command. # rm [filename] Example: # rm ~/www/htdocs/old-index.html Compression Copy a file or files to or from an archive. - To put all the files located in a directory into one tarfile format file, use # tar -cvf example directory at a command prompt. Replace example with the name you want to call the archived file, and replace directory with the name of the directory that contains the files you want to compress. - To extract the compressed files from a tar format archive, use # tar -xvf example and replace example with the name of the archived file you are extracting. - To view the contents of a tar format archive file without extracting it, use # tar -tvf tarfile name. This will display all files that are included in the tar format archive. You could also use # tar -xvf tarfile name to extract the compressed contents into the current directory.

Page 19: The Freebsd Compact Reference Guide

# tar [options] [tarfile] [files] Compress a file or list of files into a zip format archive file.Use the command # zip zipfile file1 file2 file3 and replace zipfile with the name you want to use for your compressed zip archive file, and replace file# with the name of the file(s) you want to compress into the zip archive. # zip [options] [zipfile] [files]

Extract a zip format archive file.Use the command # unzip zipfile and replace zipfile with the name of the zip format archive file. # unzip [options] [zipfile]

Shutting d own t he c omputer

There are two methods for turning off a computer system.

The computer hardware DOES support ACPI - Advanced Configuration and Power Interface.(ACPI hardware compatability can be determined by checking the computer BIOS configuraiton.)# shutdown -p now

The computer hardware DOES NOT support ACPI.# shutdown -h nowManualy turn off the power switch off.

Page 20: The Freebsd Compact Reference Guide

Packages And Ports

Installing p ackages

Remote FTP installation:pkg_add -r package_name

Local installation:pkg_add package_name

You must navigate to the location where the package is residing and execute the pkg_add command with the exact file name to install the package.

Example:# cd /home/user/Desktop/# pkg_add wow_1234.tbz

Installing p orts

Obtain and update port collection:# portsnap fetch# portsnap extract# portsnap update Locate the port you wish to install.(You can locate specific ports on your system using www.freshports.org)

Example:

Navigate to the port location:# cd /usr/ports/www/firefox/ && make install clean

Install:# make install clean

System p ackages a nd p orts i nformation

Display a list of all currently installed packages.# pkg_info -a

Display one line comment field for each installed package.# pkg_info -c

Display the long description field for each installed package.# pkg_info -d

Display a list of all currently installed packages that have a specified word in the package name.# pkg_info | grep -i package_name

Removes packages and ports.# pkg_delete package_name

Page 21: The Freebsd Compact Reference Guide

Adding Hardware

- Network Card

- Sound Card

- Wireless Networking

- Webcam

- Common UNIX Printing System

Page 22: The Freebsd Compact Reference Guide

Network Card

Additional network interface cards can be configured after the FreeBSD installation.

- Initiate sysinstall: # sysinstall

This information screen will open: FreeBSD - sysintall Main Menu.

- Select this option: Configure Do post-install configuration of FreeBSD.

This information screen will open: FreeBSD Configuration Menu.

- Select this option: Networking Configure additional network services.

This information screen will open: Network Services Menu.

- Select this option: Interfaces Configure additional network interfaces.

This information screen will open: Network interface information required.

- Select this option:The network interface card that you desire to configure.

- Select the appropriate nework interface card.

* If the install network interface card is not listed, you will need to manually configure the device.www.freebsd.org/doc/en/books/handbook/config-network-setup.html

Page 23: The Freebsd Compact Reference Guide

Sound Card

You must check to see which sound card is detected with this command:# cat /dev/sndstat

You must add the detected sound driver manually to the /boot/loader.conf file.# nano /boot/loader.conf This line needs to be added to the /boot/loader.conf file:snd_xxx_load="YES"

xxx is the sound card driver that is detected by the cat /dev/sndstat command.

The sound card driver must be added using lower case letters.

Page 24: The Freebsd Compact Reference Guide

Wireless Networking

Do a post installation configuration to add a wireless network device.

This must be done while logged in as root.

(# indicates a typed command.)

# sysinstall

Select: Configure Do post-install configuration of FreeBSD.Select: Networking Configure additional network services.Select: Interface Configure additional network interfaces.Select installed wireless network device.

Supported wireless network devices:www.freebsd.org/releases/8.0R/hardware.html#WLAN

Open source wireless drivers:en.wikipedia.org/wiki/Comparison_of_open_source_wireless_drivers

OR

Identify installed wireless network devices with pciconf.pciconf is a diagnostic utility for the PCI bus.

# pciconf -lv |grep Wireless device = 'Intel 3945ABG Wireless LAN controller (10208086)'(Example device display)

Once the wireless network device has been installed or identified, it must be loaded on boot and included in the /boot/loader.conf file.

Edit the /boot/loader.conf file:# nano /boot/loader.conf

This line needs to be added to the /boot/loader.conf file:if_xxx_load="YES" (xxx is the wireless device)

Wireless c ryptographic support

These modules must be loaded at boot time to enable cryptographic support for security protocols.

Edit the /boot/loader.conf file:# nano /etc/rc.conf

Add these lines to the /boot/loader.conf file:wlan_wep_load="YES"wlan_ccmp_load="YES"wlan_tkip_load="YES"

The control of the wireless connection and the authentication (key negotiation or authentication with a server) is done with the wpa_supplicant utility.

WEP

The wpa_supplicant can be used to configure the wireless network device with WEP encryption.

Edit the /etc/wpa_supplicant.conf file:

Page 25: The Freebsd Compact Reference Guide

# nano /etc/wpa_supplicant.conf

Add these lines to the /etc/wpa_supplicant.conf file:network={

ssid="YOUR_NETWORK" key_mgmt=NONE wep_key0=6666666666 wep_tx_keyidx=0 priority=5

}

Set wireless wireless network device to use DHCP

Edit the /etc/rc.conf file:# nano /etc/rc.conf

Add these lines to the /etc/rc.conf file:ifconfig_wlan0="WPA DHCP"

Initializing interface

# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf

The following arguments must be specified with the wpa_supplicant commands:

-i ifname Use the specified wireless interface.

-c config-file Use the settings in the specified configuration file when managing the wireless interface.

WAP

The wpa_supplicant is used to configure the wireless network device with WAP encryption.

Edit the /etc/rc.conf file:# nano /etc/rc.conf

Add these lines to the /etc/rc.conf file:network={

ssid="YOUR_NETWORK" psk="Password" priority=5

}

Set wireless wireless network device to use DHCP

Edit the /etc/rc.conf file:# nano /etc/rc.conf

Add these lines to the /etc/rc.conf file:ifconfig_wlan0="WPA DHCP"

Initializing interface

# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf

Page 26: The Freebsd Compact Reference Guide

The following arguments must be specified with the wpa_supplicant commands:

-i ifname Use the specified wireless interface.

-c config-file Use the settings in the specified configuration file when managing the wireless interface.

www.michielovertoom.com/freebsd/wifi-configuration/

albertux.ayalasoft.net/2010/02/28/freebsd-wireless-wep-wap/

www.howtobsd.com/?p=186

jasonk2600.wordpress.com/2010/01/09/quickie-howto-wireless-access-in-freebsd-8/

www.unix.com/man-page/FreeBSD/8/wpa_supplicant/

www.freebsd.org/doc/en/books/handbook/network-wireless.html

Wifimgr is a GTK+-based GUI for management of WiFi networks on BSD systems. It acts as an interface to the existing /etc/wpa_supplicant.conf network configuration file, and supports WEP and WPA-PSK security.

Install wifimgr:# pkg_add -r wifimgr

Support for the FreeBSD wifimgr must be included in the /etc/rc.conf file.

Edit the /etc/rc.conf file:# nano /etc/rc.conf

These lines need to be added to the file:wlans_ath0=”wlan0”ifconfig_wlan0="WPA DHCP"

Freebsd wifimgr help.opal.com/freebsd/ports/net-mgmt/wifimgr/

* Important – Important – Important – Important – Important – Important – Important – Important – Important *

Once you are connected to a wireless access point – you must use this command to acquire a network address:

(# indicates a typed command.)

# dhclient wlan0

* Important – Important – Important – Important – Important – Important – Important – Important – Important *

Page 27: The Freebsd Compact Reference Guide

Webcam

Webcam and DVB Compatibility Listwiki.freebsd.org/WebcamCompat

Install additional webcam support for FreeBSD.

(# indicates a typed command.)

Install the following packages:

# pkg_add -r v4l_compat# pkg_add -r libv4l# pkg_add -r pwcview# pkg_add -r cuse4bsd-kmod# pkg_add -r webcamd

Restart devd:# sudo /etc/rc.d/devd restart

Load cuse4bsd:# sudo kldload cuse4bsd

Initailize cuse4bs d and webcamd at start up

Edit the /boot/loader.conf file:# nano /boot/loader.conf

Add this line to the /boot/loader.conf file:cuse4bsd_load="YES"

Edit the /etc/rc.conf file: # nano /etc/rc.conf Insert this line to the /etc/rc.conf file: webcamd_enable="YES"

Set permissions for the device

Edit the /etc/rc.conf file:# nano /etc/rc.conf

Add the following lines to the /etc/rc.conf file:devfs_system_ruleset="system"

Edit the /etc/devfs.rules file:# nano /etc/devfs.rules

Add the following lines to the /etc/devfs.rules file:[system=10] add path 'video*' mode 0666

Test webcam to set if it is functioning properly # pwcview

Page 28: The Freebsd Compact Reference Guide

www.selasky.org/hans_petter/video4bsd/

forums.freebsd.org/showthread.php?t=15224

www.rockafunk.org/InstallWebcamd.html

wangjianjun.wordpress.com/2010/09/29/webcam-on-freebsd/

Page 29: The Freebsd Compact Reference Guide

Common UNIX Printing System

(#indicates a typed command.)

Install cups software package:# pkg_add -r cups

Enabling cups printing.

You must manually edit these two individual files: /usr/local/etc/cups/mime.types /usr/local/etc/cups/mime.convs # nano /usr/local/etc/cups/mime.types # nano /usr/local/etc/cups/mime.convs

You must uncomment the following line contained in each file:

application/octet-stream

Remove the ; from the front of this line to uncomment it.

You must manually edit the /etc/devfs.rules file: # nano /etc/devfs.rules

You must add the following lines to the /etc/devfs.rules file:

[system=10]add path 'unlpt*' mode 0660 group cupsadd path 'ulpt*' mode 0660 group cupsadd path 'lpt*' mode 0660 group cupsadd path 'usb/X.Y.Z' mode 0660 group cups

You must manually edit the /etc/rc.conf file: # nano /etc/rc.conf

You must add the following lines to the /etc/rc.conf file:cupsd_enable=”YES”devfs_system_ruleset=”system”

A dditional device drivers for for specific printer s may need to be installed

Drivers and utilities for HP Printers and All-in-One devices:# pkg_add -r hplip

Printer listingswww.openprinting.org/printers

Printer driver listingswww.openprinting.org/drivers

Search for the printer you wish to install and download the correct ppd file.

Install the ppd printer file using the cups web interface. This interface can be accessed from any web browser at this URL/address: http://localhost:631

Page 30: The Freebsd Compact Reference Guide

Binary Operating System Compatibility

- Linux Compatibility Configuration

- Windows Compatibility Configuration

Page 31: The Freebsd Compact Reference Guide

Linux Compatibility Configuration

Linux compatibility allows the installation and execution of Linux compiled software on the FreeBSD operating system.

To enable Linux emulation, perform the following steps:(# indicates a typed command.)

Load the Linux kernel module:# kldload linux

To enable Linux compatibility at system boot:

Edit the /etc/rc.conf file:# nano /etc/rc.conf

This line needs to be added to the /etc/rc.conf file:linux_enable="YES”

Install the packages for Linux mode – I386 / Amd64 (Linux Fedora 10):# cd /usr/ports/emulators/linux_base-f10/# make install clean

Create shadow root for Linux compatibility:# cd /# mkdir /compat/linux

Use the brandelf utility to help the FreeBSD kernel distinguish between a FreeBSD elf binary from a Linux binary:# brandelf -t Linux my-linux-elf-binary

How to install Linux RPM-based applications:# cd /compat/linux # rpm2cpio -q < /path/to/linux.archive.rpm | cpio -id

Note:Depending on the Linux software that is selected to be installed, additional Linux libraries may be required.

InstallingLinux Binary Compatibility.www.freebsd.org/doc/en/books/handbook/linuxemu-lbc-install.html

FreeBSD RPM manager Man Page.www.freebsd.org/cgi/man.cgi?query=rpm&apropos=0&sektion=0&manpath=FreeBSD+Ports&format=html

Linux programs that can be run under binary compatibility.www.freebsd.org/ports/linux.html

The search engine for Linux RPM packages.www.rpmseek.com

Page 32: The Freebsd Compact Reference Guide

Windows Compatibility Configuration

Wine is a software application that allows computer programs written for Microsoft Windows to run on Unix-like operating systems. Wine is not an emulator, it creates a compatibility layer for Windows software.

Wine

Microsoft Windows compatibility layer for Unix-like systems It is written for the 386 architect but can be run under the AMD64 architecture.

To install the port: # cd /usr/ports/emulators/wine/ && make install clean

Winetricks

A script to download and install various redistributable runtime libraries that may be needed to run Windows applications in Wine.

wiki.winehq.org/winetricks

Q4wine

A Qt4 GUI for wine. It is designed to help manage wine prefixes and installed applications. It is written for the 386 architect but can be run under AMD64 architecture.

q4wine.brezblock.org.ua

To install the port: # cd /usr/ports/deskutils/q4wine/ && make install clean

Wine-doors

Windows application management for the GNOME Desktop.

# pkg_add -r wine-doors

Page 33: The Freebsd Compact Reference Guide

Software Firewalls

IPFIREWALL is a FREEBSD sponsored IP packet filter and traffic accounting application.

This module must be loaded at boot time.

Edit the /etc/rc.conf file: # nano /etc/rc.conf

Add this line to the /etc/rc.conf file:firewall_enable="YES"

After these changes are made, reboot your system.

The following highlighted message is displayed on the screen as part of the boot process: ipfw2 initialized, divert disabled, rule-based forwarding disabled, default to deny, logging disabled

The IPFW sample ruleset can be found in the following files /etc/rc.firewall and /etc/rc.firewall

IPFILTER provides a kernel resident firewall and NAT application.

This module must be loaded at boot time.

Edit the /etc/rc.conf file:# nano /etc/rc.conf

Add this line to the /etc/rc.conf file:ipfilter_enable="YES"

OpenBSD Packet Filter (PF) is similar to IPFilter, with some modifications to make it clearer.

This module must be loaded at boot time.

Edit the /etc/rc.conf file:# nano /etc/rc.conf

Add this line to the /etc/rc.conf file:pf_enable="YES"

Execute the startup script to load the PF module:# /etc/rc.d/pf start

The default location of the ruleset configuration file is /etc/pf.conf.

Virus Clamav - Command line virus scanner written entirely in C.

Install:# pkg_add -r clamav Configuring clamav: Edit the /etc/rc.conf file: # nano /etc/rc.conf Insert these lines to the /etc/rc.conf file: clamav_freshclam_enable=”YES” clamav_clamd_enable=”YES”

Page 34: The Freebsd Compact Reference Guide

Starting Clamav Daemon: # /usr/local/etc/rc.d/clamav-clamd start Update virus database: # freshclam Jail r esources The FreeBSD jail mechanism is an implementation of operating system-level virtualization that allows administrators to partition a FreeBSD-based computer system into several independent mini-systems called jails. This is used to protect the computer system from being compromised by running specific software applications. The FreeBSD Handbook section on jails. www.freebsd.org/doc/handbook/jails.html Quick guide to ezjail. www.scottro.net/qnd/qnd-ezjail.html ezjail A framework to easily create, manipulate and run FreeBSD jails. # pkg_add -r ezjail jailadmin A system for managing a set of named jails. # pkg_add -r jailadmin

Java R untime Environment

OpenJDKOpen-source implementation of the Java Platform, standard edition.# pkg_add -r openjdk6

Page 35: The Freebsd Compact Reference Guide

References

FreshPorts has everything you want to know about FreeBSD software, ports, packages and applications. www.freshports.org The FreeBSD Handbook. www.freebsd.org/doc/en/books/handbook The complete FreeBSD (Book). www.lemis.com/grog/Documentation/CFBSD

Comprehensive Guide to FreeBSD. www.vmunix.com/fbsd-book

FreeBSD Hints & Kinks. myfreebsd.homeunix.net/hints_n_kinks FreeBSD Security Advisories. security.freebsd.org/advisories