In Linux, run the Windows binary Program-general Linux technology-Linux programming and kernel information. For more information, see the following. Although most linux enthusiasts do not use Windows, many people are still accustomed to some software under Windows, rather than looking for alternatives from open-source repositories.
Of course, you can use the GNU/Linux system with Wine to solve this problem. But there is something unpleasant: every time you want to start these programs, you have to enter cd ~ /. Wine/drive_c/Program \ Files \ My \ Windows \ App; wine My \ Windows \ App.exe
Note that each time. Using shell scripts is not a good idea. Is there any way to run these programs in xterm directly through My \ Windows \ App.exe?
Fortunately, the Linux kernel feature binfmt_misc is enough to help you achieve this.
This feature is available when you run the stock kernel of your Linux version. If you do not have a custom core, or you want to use it, determine whether it is built-in or as a module, select CONFIG_BINFMT_MISC (Executable file formats-> Kernel support for MISC binaries ). In the latter case, make sure that the binfmt_misc module is automatically loaded at startup (echo binfmt_misc>/etc/modules can be run in Debian and Debian systems ). Then mount binfmt_misc-t binfmt_misc/proc/sys/fs/binfmt_misc to mount bifmt_misc, or copy the following characters to your/etc/fstab file, to ensure that it is automatically mounted at each start: none/proc/sys/fs/binfmt_misc defaults 0 0
Now, you must tell binfmt_misc to run the win16 or win32 application by calling/usr/bin/wine. Note that the wine path must be a full path, otherwise it cannot work: echo ': DOSWin: M: MZ:/usr/bin/wine: '>/proc/sys/fs/binfmt_misc/register
Next we need to make this setting permanently effective. If you are using gentoo, copy the preceding command to your/etc/rc. d/rc. local or/etc/conf. d/local. start file. If you are using a Debian-based release, copy the following command to/etc/init. d/wine :#! /Bin/sh test-e proc/sys/fs/binfmt_misc/register | exit 0 case "$1" in start) echo ': DOSWin: M: MZ :: /usr/bin/wine: '>/proc/sys/fs/binfmt_misc/register; stop) echo 0>/proc/sys/fs/binfmt_misc/status ;;*) echo "Usage: $0 {start | stop}"> & 2 exit 3; esac then, through chmod 755/etc/init. d/wine allows users to execute files. Then run the update-rc.d wine start 99 2 3 4 5. stop 10 0 1 6. Let it start to work during startup.
The last step is to confirm that your Windows binary program can be executed. Of course, you can still use the command chmod 755. /My \ Windows \ App.exe next, you can run it like running a linux program. For convenience, you can also create a symbol to connect to any of your PATH paths, such as/usr/local/bin.
In the same way, binfmt_misc can run programs written in java and python. For more information, see Documentation/binmft_misc.txt in any newer version of the kernel package.
This technology may still have some security issues in applications ------ for example Local Elevation of Privilege ------ therefore, please make trusted users use it in updated systems. A better way is to mount your/proc file system through the nosuid attribute.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service