mono.rst 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. Mono(tm) Binary Kernel Support for Linux
  2. -----------------------------------------
  3. To configure Linux to automatically execute Mono-based .NET binaries
  4. (in the form of .exe files) without the need to use the mono CLR
  5. wrapper, you can use the BINFMT_MISC kernel support.
  6. This will allow you to execute Mono-based .NET binaries just like any
  7. other program after you have done the following:
  8. 1) You MUST FIRST install the Mono CLR support, either by downloading
  9. a binary package, a source tarball or by installing from Git. Binary
  10. packages for several distributions can be found at:
  11. http://www.mono-project.com/download/
  12. Instructions for compiling Mono can be found at:
  13. http://www.mono-project.com/docs/compiling-mono/linux/
  14. Once the Mono CLR support has been installed, just check that
  15. ``/usr/bin/mono`` (which could be located elsewhere, for example
  16. ``/usr/local/bin/mono``) is working.
  17. 2) You have to compile BINFMT_MISC either as a module or into
  18. the kernel (``CONFIG_BINFMT_MISC``) and set it up properly.
  19. If you choose to compile it as a module, you will have
  20. to insert it manually with modprobe/insmod, as kmod
  21. cannot be easily supported with binfmt_misc.
  22. Read the file ``binfmt_misc.txt`` in this directory to know
  23. more about the configuration process.
  24. 3) Add the following entries to ``/etc/rc.local`` or similar script
  25. to be run at system startup:
  26. .. code-block:: sh
  27. # Insert BINFMT_MISC module into the kernel
  28. if [ ! -e /proc/sys/fs/binfmt_misc/register ]; then
  29. /sbin/modprobe binfmt_misc
  30. # Some distributions, like Fedora Core, perform
  31. # the following command automatically when the
  32. # binfmt_misc module is loaded into the kernel
  33. # or during normal boot up (systemd-based systems).
  34. # Thus, it is possible that the following line
  35. # is not needed at all.
  36. mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
  37. fi
  38. # Register support for .NET CLR binaries
  39. if [ -e /proc/sys/fs/binfmt_misc/register ]; then
  40. # Replace /usr/bin/mono with the correct pathname to
  41. # the Mono CLR runtime (usually /usr/local/bin/mono
  42. # when compiling from sources or CVS).
  43. echo ':CLR:M::MZ::/usr/bin/mono:' > /proc/sys/fs/binfmt_misc/register
  44. else
  45. echo "No binfmt_misc support"
  46. exit 1
  47. fi
  48. 4) Check that ``.exe`` binaries can be ran without the need of a
  49. wrapper script, simply by launching the ``.exe`` file directly
  50. from a command prompt, for example::
  51. /usr/bin/xsd.exe
  52. .. note::
  53. If this fails with a permission denied error, check
  54. that the ``.exe`` file has execute permissions.