This guide was written to setup Linux® compatibility for FreeBSD. This guide was done in GhostBSD, should work for FreeBSD and other BSD derivatives.
In order to load Linux kernel module, run the following command:
#kldload linux
# you can load linux64
kernel module as well
To check if aforementioned module is loaded, run #kldstat
. You should see in the output.
Next you will need to install Linux® libraries and binaries from ports tree ( or pkg if you wish )
#cd /usr/ports/emulators/linux_base-c6 && make config-recursive && make install clean
Once you are done with above steps, go ahead and download and .rpm
package to test your setup. To install .rpm
package, you will need to install archivers/rpm4
. The installation command is similar to linux_base-c6
. Now run following commands in order:
#cd /compat/linux
-#rpm2cpio < **<path_to_rpm_package>** | cpio -id
For this guide, I have installed htop
application, so to run, change directory to compat/linux
and run htop
binary. It should work, it worked for me.
Update: below steps get Linux emulator running:
Enable Linux Emulation - BSD
kldload linux
kldload linux64
pkg install emulators/linux_base-c7
pkg install archivers/rpm4
put in /etc/fstab
[code lang=text]
linprocfs /compat/linux/proc linprocfs rw 0 0
linsysfs /compat/linux/sys linsysfs rw 0 0
tmpfs /compat/linux/dev/shm tmpfs rw,mode=1777 0 0
[/code]
mount /compat/linux/proc
mount /compat/linux/sys
mount /compat/linux/dev/shm
mkdir -p /var/lib/rpm
/usr/local/bin/rpm --initdb
echo 'linux_enable="YES"'>>/etc/rc.conf
Resource: Chapter 10. Linux® Binary Compatibility.