FreeBSD: Tips and Tricks

Create FreeBSD jail without compiling userland.

I found an website explaining installing FreeBSD jails without compiling userland (make buildworld) first, altough the steps where clear and complete I screwed up my FreeBSD installation because of a minor typo (entering parameters in all lowecase instead of camel case). Then I decided to write a script avoiding this to happen in the future.

I you find this useful as well, you can find this script in my bitbucket repository

Posted by Administrator on May 07, 2011

Installing Passenger Nginx module on FreeBSD

Currently (at least when I wrote this article) the FreeBSD ports system didn't contain a port for the Passenger Nginx module to deploy a Ruby on Rails application in the Nginx webserver, but it did contain all the necessary components. It is rather simple the use the nginx and rubygem-passenger from the port system and enable passenger support in Nginx. Continue Reading…

Posted by Johan Bakker on May 16, 2009

Install FreeBSD 7.0 on a ZFS partition

ZFS is an exciting new file system developed by Sun and recently ported to FreeBSD. Many people are excited by the possibilities of ZFS (including us) as it promises to simplify a great many things. It offers:

  • increased reliability through checksums, multiple copies of data and self-healing RAID
  • elimination of that dreaded “oh, if only I’d made the /var partition larger” feeling. Partitions can now be resized at any time and in fact can each be allocated up to the full size of the storage media.
  • built-in compression and encryption
  • built-in NFS file sharing
  • clean, easy to use toolset for creating storage pools, volumes and much more
  • snapshots and rollbacks for backups
Continue Reading…

Posted by Administrator on Jan 01, 2008

Network cloning a FreeBSD system

On this website I found the following tip:

Cloning a FreeBSD system

Simplifying by assuming a single partition, a secure network, and ucspi-tcp already installed on ORIG

Install fresh hard disk in CLONE, and boot from a FreeBSD rescue floppy.

Rather than installing, go to the “configure” submenu and do “fdisk” and “slice.” Use W Q instead of just Q to quit each one. Install a boot manager just as if you were building a new system.

Go back to the main menu and choose “fixit,” then “live filesystem on CD-ROM.”

Continue Reading…

Posted by Administrator on Nov 28, 2007

Checking Memory Usage on FreeBSD

You can check the installed memory in a FreeBSD box with the following one liner: sysctl vm.vmtotal Continue Reading…

Posted by Administrator on Apr 19, 2007

Remote kernel debugging in FreeBSD using serial communication

Explore how to remotely debug a FreeBSD kernel that is running on a target machine without affecting system performance. In this article, examine setting up the debug environment using serial communication port, compiling modified kernel code, debugging, and troubleshooting tips.

Continue Reading…

Posted by Administrator on Mar 13, 2007

FreeBSD: Vidcontrol SC_PIXEL_MODE and GDM

If you tried just like me to use different video mode settings in combinations with GDM and struggled with Video corruption. Or the console screen did n’t show anything when switching from X11 to the console.

There is a very easy workaround/solution for this:

Continue Reading…

Posted by Administrator on Feb 06, 2007

FreeBSD: Add/Change disk partitions on mounted disks

Ever tried to change or add partitions from within FreeBSD but failed because it already had mounted (other) partitions? Now you can !

Change the following kernel parameter:

kern.geom.debugflags=16

now you can use sysinstall to add / delete partitions as well as disk labels.

Continue Reading…

Posted by Administrator on Jan 31, 2007

Software RAID1 on FreeBSD

Since 5.3-Release, FreeBSD has gmirror utility, which allows you create software RAID1. So if you have some low-end server and you need some redundancy – gmirror is right choice.

RAID1 creation process is very simple and completely described in gmirror(8) man page, but i will post small how-to here.

Continue Reading…

Posted by Administrator on Dec 26, 2006

Compile DB_File from Perl5.8 on FreeBSD with a different version of Berkley DB

I still like SquidGuard as a squid redirector and I use a couple of perl scripts to maintain the proxy blacklists from Urlblacklist.com. But in order to get the perl DB_File module working with the same version of BerkleyDB (3) that SquidGuard requires it is needed to change the default make file from the FreeBSD portstree

Continue Reading…

Posted by Administrator on Dec 16, 2006

FreeBSD: Setup Squid with Clamav antivirus

If you want to protect a lan network from viruses downloaded from Internet, an interesting solution is to use Squid proxy with Clamav antivirus. This setup was tested succesfuly on FreeBSD 6.1 (it shoud work in 5.4 too).

You can find the howto here

Continue Reading…

Posted by Administrator on Dec 14, 2006

OpenVPN with FreeBSD, PF and Windows XP

This describes howto use a OpenVPN client installed on windows to connect to a VPN concentrator installed on a FreeBSD box protected by PF.

Continue Reading…

Posted by Administrator on Dec 08, 2006

Building a High-performance Computing Cluster Using FreeBSD

Abstract

In this paper we discuss the design and implementation of Fellowship, a 300+ CPU, general use computing cluster based on FreeBSD. We address the design features including configuration management, network booting of nodes, and scheduling which make this cluster unique and how FreeBSD helped (and hindered) our efforts to make this design a reality.

Continue Reading…

Posted by Administrator on Nov 23, 2006

FreeBSD: Practical rc.d scripting in BSD

Beginners may find it difficult to relate the facts from the formal documentation on the BSD rc.d framework with the practical tasks of rc.d scripting. In this article, we consider a few typical cases of increasing complexity, show rc.d features suited for each case, and discuss how they work. Such an examination should provide reference points for further study of the design and efficient application of rc.d.

In this article Yar Tikhiy describes how to use the BSD rc.d framework.

Continue Reading…

Posted by Administrator on Nov 01, 2006

FreeBSD: Xen Howto

This how-to was orignaly posted on www.yuanjue.net but is no longer exists.

How to install FreeBSD as domU

NOTE: All these works here are still under testing and may not be suitable for production environment. We only support FreeBSD/i386 for now. As for the dom0 suppport of FreeBSD, we still need some time to get it ready. Stay tuned :-) How to install FreeBSD as domU

There are several files needed if one wants to install FreeBSD as a domU domain: kernel (freebsd-XENU_INSTALL & freebsd-XENU), config (freebsd_xen_INSTALL) and of course an image file if you install FreeBSD into a file instead of a real hard disk.

Continue Reading…

Posted by Administrator on Oct 29, 2006

FreeBSD: How to mount a iso image

To mount an iso image as if it were a cd one uses the mdconfig command. The man page gives more information, but the procedure would be, assuming you were in the same directory as image.iso

mdconfig -a -t vnode -f image.iso

Continue Reading…

Posted by Administrator on Oct 27, 2006

FreeBSD: How to set random password for user.

To generate a random password for a user (after having used the adduser script, which gives you the option to do that when first creating the user) once again the pw command is used.

Continue Reading…

Posted by Administrator on Oct 27, 2006

FreeBSD: Networking Basics

Beginners to Unix-like operating systems such as FreeBSD are often stymied by their network settings. Sure, the install process may have set up your NIC for you, but where do you go to view these settings, and how do you proceed if your NIC stops working? Since networking is such an integral part of computing, this article will demonstrate how to verify, configure, and optimize your network settings.

Continue Reading…

Posted by Administrator on Oct 25, 2006

Save 90% of diskspace on your FreeBSD jails by using a shared /usr.

You can save 90% of the disk-usage (aprx. 16MB only instead of 180MB) of a plain jail by sharing the /usr from the jail-host:

cd /opt/jails/192.168.0.100; rm -rf /usr; mkdir usr
mount -t null -o ro /usr /opt/jails/192.168.0.100/usr

and you need to change the /etc/rc.conf of the jail(s) with shared /usr slightly:

local_startup=”“

So the jails do not search startup in the /usr/local/etc/rc.d (of the jail-host).

jail_install takes the argument -light which does all the steps described above, then jail_start and jail_stop mount and umount /usr for you.

Important Note: The jail_root (defined in /usr/local/etc/jail.conf) must lie outside /usr (not /usr/jails) but /opt or something else, otherwise mount -t null won’t work as distinct paths (paths which are not part of each other) required.

I created a dedicated slice (/opt/) on my jail-host which only hosts the jails:

/dev/ad0s1a on / (ufs, local) /dev/ad0s1e on /var (ufs, local, soft-updates) /dev/ad0s1f on /tmp (ufs, local, soft-updates) /dev/ad0s1g on /usr (ufs, local, soft-updates) /dev/ad0s1h on /opt (ufs, NFS exported, local, soft-updates)

Continue Reading…

Posted by Administrator on Oct 22, 2006

Tivoli Storage Manager (TSM) installation on FreeBSD

On FreeBSD 5.x it is possible to install IBM’s Tivoli Storage Manager by patching the Linux compatibility layer. On FreeBSD 6.x it has some issue’s (scheduler doesn’t work, but if scheduled via the crontab it works fine).

For the instructions how to install TSM and patch the Linux compatibility layer click here

Continue Reading…

Posted by Administrator on Oct 11, 2006

FreeBSD: Update userland and build a new kernel

cd /usr/src
make buildworld
make buildkernel KERNCONF=MYKERN
make installkernel KERNCONF=MYKERN
reboot
Reboot into single user mode
fsck -p
mount -u /
mount -a
cd /usr/src
adjkerntz -i
mergemaster -p
make installworld
mergemaster
exit
Continue Reading…

Posted by Administrator on Oct 10, 2006