This tutorial will illustrate how to install and configure Wine on FreeBSD 12.0.
Installing Wine on FreeBSD
We will use the FreeBSD ports repository to get the latest packages for Wine, both for stable and development versions. If you’re using the 32-bit version of FreeBSD, just put the commands below to install Wine stable:
For Wine development (32 bit):
For Wine experimental (32 bit):
However, if you’re using the 64-bit version of FreeBSD, download the i386 packages for Wine that allows 32-bit packages to run on 64-bit operating systems.
For Wine stable (64 bit):
For Wine Development (64 bit):
For wine experimental (64 bit):
Building Wine with chroot
First, add all the relevant i386 files into the chroot folder.
To build Wine on FreeBSD, we’ll use chroot as follows:
$ make buildworld TARGET=i386
$ make installworld TARGET=i386 DESTDIR=/compat/i386
$ make distribution TARGET=i386 DESTDIR=/compat/i386
$ mkdir /compat/i386/usr/ports
Then, append the mount points for the relevant directories:
$ mount -t nullfs /usr/ports /compat/i386/usr/ports
Then, issue the commands below to start idconfig:
$ setenv MACHINE i386
$ setenv UNAME_m i386
$ setenv UNAME_p i386
$ service ldconfig start
Then, head over to any directory and extract the package:
$ make package
Binary Image Activation
You can make configurations to the FreeBSD kernel so that every time a Windows binary file is opened, it is launched in Wine. This allows you to keep windows binaries like any other binaries on FreeBSD.
With root access, issue the command below:
--magic "\x4d\x5a\x90\x00\x03\x00\x00\x00\x04\x00\x00\x00\xff\xff\x00\x00\xb8\x00\x00\x00" \
--mask "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" \
--size 20 --set-enabled
It is important to remember that Wine cannot detect the presence of infected windows applications, so make sure you’re getting the windows applications from official sources.
In conclusion
With Wine, you can run pretty much any Windows application, including video games. You’ll likely encounter some bugs and compatibility issues in your experience with Wine, especially when you work with heavier applications.