Difference between revisions of "FreeBSD"

From Hackepedia
Jump to navigationJump to search
Line 19: Line 19:
 
== Jails ==
 
== Jails ==
  
See [[Jails]].
+
Jails are a way to contain an instance of userland in a chroot-like setting.  Some VPS providers use Jails as their service.  See [[Jails]].
  
 
== Ports ==
 
== Ports ==

Revision as of 02:14, 12 June 2011

FreeBSD is an open-source operating system based on 4.4BSD lite2. The FreeBSD Project Homepage. The FreeBSD project has probably the most developers out of any BSD project currently active.


FreeBSD 8.2-RELEASE

The current version of FreeBSD is 8.2-RELEASE

FreeBSD Release page

rc.conf recommendations

/etc/rc.conf recommendations:

This will stop syslog from opening a socket. This is highly recommended unless you do remote syslogging. If you're unsure, you can safely make this change.

syslogd_flags="-ss"


You can get defaults for /etc/rc.conf out of /etc/defaults/rc.conf. This is very helpful, if you use grep against that you can pull out what you need and change it.

Jails

Jails are a way to contain an instance of userland in a chroot-like setting. Some VPS providers use Jails as their service. See Jails.

Ports

Cleanup hints if you're using ports. Once in a while look for:

# ls /usr/ports/distfiles/

which is leftover packages you've downloaded to install. You can remove these if the install is complete

# find /usr/ports/ -name work -type d -print 

this is old work directories left around from an install you've done. When you install from ports if you do:

# make install distclean

the distclean will clean this work directory as well as the distfiles.

Also make sure you have a regular patching process.


FreeBSD:php Help with installing php from ports on FreeBSD. FreeBSD:apache22:ssl Getting SSL working with apache22.


You may want to look at special defines when using ports. For example, if you wanted to compile mtr from ports without X11:

$ cd /usr/ports/net/mtr
$ grep defined Makefile 
.if defined(WITHOUT_X11)
.if defined(WITHOUT_IPV6)

# make -DWITHOUT_X11 install distclean

Hints

Unlike cat(1) on most OS', the cat on FreeBSD can't handle cat'ing directories:

$ cat elcheapo/
Ê
 .

and then the terminal will appear to lock up. If you type "reset" (even though you will not see your typing) when this happens you will rescue your session so you don't have to quit it and start over.


Patching

# cat /bin/update
portsnap fetch update
/usr/local/sbin/portaudit -Fda
pkg_version  -v -l "<"


# cat /bin/upgrade
/usr/local/sbin/portupgrade -a

Once you have these two scripts, run each regularly, at your convenience.

Ported Programs that Originated at FreeBSD

  • ipfw runs on FreeBSD, DragonflyBSD and Mac OS X
  • a lot of wifi and ethernet drivers written mainly by Bill Paul.

Open Issues and Observances

A FreeBSD 7.2-RELEASE vmware instance takes up more CPU than other vmware instances on the same host. In a top from the host operating system:

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
 3363 pjp        5 -10  653m 574m 558m S 13.0 14.6   1000:22 vmware-vmx         
15789 pjp        5 -10  518m 294m 283m S  8.7  7.5 489:56.54 vmware-vmx         
28973 pjp        5 -10  373m 274m 267m S  5.7  7.0   0:46.29 vmware-vmx         
15815 pjp        5 -10  391m 286m 277m S  1.0  7.3  45:01.09 vmware-vmx         
15823 pjp        5 -10  380m 295m 284m S  1.0  7.5  34:11.55 vmware-vmx         

FreeBSD is pid 28973. DragonflyBSD is pid 15823. Both idle but huge difference in CPU usage. On the hosts themselves what was noticed was there was higher context switch rates on FreeBSD compared to DragonflyBSD (on the order of 3 to 4 times what it is on dflybsd). Since DragonflyBSD is based on FreeBSD 4 it's possible that FreeBSD 7.2 is more cpu intensive due to its fine grained kernel locking (not sure). Google mentions other people seeing high context switches and wondering about them as well.