Cómo configurar la emulación de Linux en FreeBSD

I - Introducción

Este HOWTO te muestra cómo configurar la emulación de Linux en FreeBSD. Hay muchas razones por las que te puede interesar:

  • Ejecutar software de código cerrado de Linux

  • Seguridad

  • Investigación

  • Simplemente por diversión / porque puedes

II - Preparación

1) Cargar los módulos del kernel

Carga el módulo del kernel de Linux:

root@bsdbox:/root # kldload linux

III - Instalación

1) Instalar la emulación de Linux desde los puertos

Elegimos Fedora Core 10:

root@bsdbox:/root # cd /usr/ports/emulators/linux_base-f10/
root@bsdbox:/usr/ports/emulators/linux_base-f10 # make install clean
+++ Some programs may need linprocfs, please add it to /etc/fstab! +++

Running linux ldconfig...

This software is based in part on the work of the FreeType Team.
See <URL:http://www.freetype.org/>.

Installation of the Linux base system is finished. The Linux kernel
mode, which must be enabled for Linux binaries to run, is now
enabled. Linux mode can be enabled permanently with the linux_enable
variable of rc.conf(5).

If you want to use shared memory in Linux applications, you need to set up
a link from /dev/shm to a suitable place, e.g. by adding the following line
to /etc/devfs.conf (takes effect on each boot):
        link /tmp shm

To make use of NIS you have to adjust yp.conf and nsswitch.conf in
/compat/linux/etc/ accordingly. For example:

Set your yp-server and yp-domainname in yp.conf:
        domainname      my.yp.domainname
        ypserver        my.yp.server

Let your lists for hosts, passwd and group be resolved via nsswitch.conf:
        passwd: files nis
        shadow: files nis
        group:  files nis
        hosts:  files dns nis

WARNING: doing work which needs to chroot into the linux base may not work.
In such cases (e.g. cross-development) you are better suited with a linux_dist
port.

===>   Registering installation for linux_base-f10-10_5
root@bsdbox:/usr/ports/emulators/linux_base-f10 # 

IV - Pruebas

1) Probar la emulación

Entra en la emulación de Linux:

root@bsdbox:/root # /compat/linux/bin/sh

Mostrar la información del sistema:

sh # uname -a

V - Conclusión

Hemos conseguido configurar con éxito la emulación de Linux en FreeBSD. Cuéntanos qué te ha gustado y qué no. ¡Gracias!