Sunday, September 18, 2016

Wine Tutorial : to installing and managing windows programs on linux.

Introduction to Wine

Different software programs are designed for different operating systems and cause of platform dependency they cant run on different platform. for example, windows programs won't run in Linux because they contain instructions that the system can't understand until they're translated by the Windows environment likewise, Linux Programs won't run under the Windows operating system because Windows is unable to interpret all of their instructions. This situation presents a fundamental problem for anyone who wants to run software for both Windows and Linux. A common solution for this problem is to install both operating systems on the same computer, known as "dual booting". When a Windows program is needed, the user boots the machine into Windows to run it; when a Linux program is needed, then the user reboots the machine into Linux.



This option presents great difficulty because of frequently rebooting of specific system and switch on to another os like windows or ubuntu. the solution of the problem is the use of wine application on mac os or linux os

Wine makes it possible to run Windows programs alongside any Unix operating system, particularly Linux. Wine is an implementation of the Windows Application Programing Interface (API) library, acting as a bridge between the Windows program and Linux. Think of Wine as a compatibility layer, when a Windows program tries to perform a function that Linux doesn't normally understand, Wine will translate that program's instruction into one supported by the system. For example, if a program asks the system to create a Windows push button or text-edit field, Wine will convert that instruction into its Linux equivalent in the form of a command to the window manager using the standard X11 protocol.

Features of wine

  • Support for running Win64, Win32 (Win 95/98, NT/2000/XP/2003/Vista/2008/7/2012/10), Win16 (Win 3.1) and DOS programs
  • Optional use of external vendor DLL files (such as those included with Windows)
  • X11-based graphics display, allowing remote display to any X terminal, as well as a text mode console
  • Desktop-in-a-box or mixable windows
  • DirectX support for games
  • Good support for various sound drivers including OSS and ALSA
  • Support for alternative input devices such as graphics tablets.
  • Printing: PostScript interface driver (psdrv) to standard Unix PostScript print services
  • Modem, serial device support
  • Winsock TCP/IP networking support
  • ASPI interface (SCSI) support for scanners, CD writers, and other devices
  • Advanced Unicode and foreign language support
  • Full-featured Wine debugger and configurable trace logging messages for easier troubleshooting   

Ubuntu versions of Wine (Recommended)

open the software center
Type wine and install 'wine'

Newer versions of Wine (Not Recommended)

If you are using an older version of Wine and want support from WineHQ, you will need to upgrade to the latest development version first. If you do this, however, please file associated Wine bugs at winehq's Bugzilla Page rather than in Launchpad.

Initial Setup of Wine

Before using Wine, it is necessary to create the fake C: drive where your Windows applications will be installed. To do this, enter the following command into the terminal (You may find the terminal by going to Applications -> Accessories -> Terminal).

winecfg
 
You also have the option of configuring Wine via the Configure Wine option in the Applications-> Wine menu. This will create a hidden folder (.wine) in your home directory containing the fake C: drive as well as registry files similar to those used in Windows. Once this directory is created, the Wine Configuration Window will appear. This window will allow you to customize a variety of settings for Wine, including which Windows Version that is emulated, drive mappings, DLL overrides, as well as application specific settings. Click the Ok button to close the window.

Installing Windows Applications With Wine

To install Windows applications using Wine, follow these instructions:
  1. Download the Windows application from any source (e.g. download.com). Download the .EXE (executable).
  2. Place it in a convenient directory (e.g. the desktop, or home folder).
  3. Open the terminal, and cd into the directory where the .EXE is located.
  4. Type wine the-name-of-the-application.extension (e.g. wine realplayer_installer.exe).
  5. This will start the .EXE using Wine. If it is an installer, it should then run as it would in Windows. If the application asks for a directory to install the application to, select put it under C:\Program Files.

To start/run Windows programs using Wine

After installing an application using the directions above, those applications can be started and used by entering wine programname.exe (e.g. wine realplayer.exe). When done, close the application as one would normally. You must run the installed executable, which will by default be in the virtual Windows drive created by Wine, at ~/.wine/drive_c. Generally programs will install themselves somewhere under Program Files inside the virtual Windows drive, following Windows conventions.

You can also use the Wine file browser, by running winefile in a terminal. Clicking the C:\ button in the toolbar will open a window where you can browse the virtual Windows drive created in .wine. Double clicking an executable in the Wine file browser will run it in Wine. 

Instead of having to always enter the terminal or use the Wine file browser, you may also create a desktop icon, and start a Wine application using that icon. To do this, right click on the desktop and select "Create a launcher." If you wish, select an icon from the list of available icons (or browse to an icon you would like to use), fill out other information that is requested (Name, generic name, etc.). For the command, type in wine the-location-of-the-program.exe (e.g. wine /home/john/.wine/realplayer.exe). The most important part of creating a launcher is the command, the generic name is not as important. Just make sure you de-select "Run in terminal." This completes the process. 

In some cases the application requires to be running from a certain location. In this case create launcher with command 

sh -c "cd /home/USER/.wine/drive_c/Program Files/Appdir/; wine /home/USER/.wine/drive_c/Program Files/Appdir/game.exe" 

Of course you will need to replace USER and Appdir with the proper data. 

If you desire to have an icon on the panel, create a launcher on the panel of choice. Do this by right-clicking the panel, selecting "Add to Panel," and selecting "Custom Application Launcher." This will ask you for the same information as before. 

Alternatively, to make life easier, you can set it so wine will automatically open .exe files files for you - instead of using the Wine File to locate the file each time. To do so, right click on the .exe file, select Properties, and then select the Open With tab. Click the 'Add' button, and then click on 'Use a custom command'. In the line that appears, type in wine, then click Add, and Close. Now all .exe files will be automatically opened by Wine, so you can use Nautilus to browse and open them instead of the Wine File.

Uninstalling Wine Applications

Open up a terminal window and type the command below.

wine uninstaller

What this will do is open up a program similar to the Windows add/remove programs control panel, allowing you to uninstall applications from a Wine installation. Running uninstall programs directly via Wine should also work normally. Alternatively, you could also simply delete the folder of the application. However, as when done in Windows, this method will be unclean and will not remove the program's configuration from the Wine registry like using an uninstaller will.

Configuring Wine

On the command line or in Run Application, type

winecfg

Adding CD and DVD drives to Wine

Go to the drives tab in winecfg. Hit the Autodetect button.
If you find that this does not work correctly for you, then follow these instructions:
  1. Open Run and Type winecfg in textbox
  2. Navigate to the drives tab
  3. Click on Add...
  4. In the path bar, type /media/cdrom
  5. Click Show Advanced button below the Browse... button and set the Type to CD-ROM
  6. Click OK
If you have more than one CD/DVD device you will need to identify each one differently. Use /media/cdrom0 for the first CD/DVD device, /media/cdrom1 for the second one, and so on. If in doubt, type the following command in your terminal.
 
ls -la ~/.wine/dosdevices/

What this command will do is check your CD/DVD device details after Wine is installed.

Adding applications to the menu 

It is good procedure before setting up the menu entry to launch the new Windows program from the command line to make sure the program runs properly. To do this type this command in the terminal. 
 
wine "C:\PATHTOPROGRAM\Program.exe"

For example the command would be wine "C:\Program Files\Medal Of Honor Allied Assault\MOHHA.exe" Once you are satisfied that you have the correct details, use the normal menu editing process to add a new entry. When you get to the Command field of the entry editor be sure to copy and paste the line you used to launch the program from the terminal. Finish and save the new entry. Test to make sure the new Windows program loads via the menu.

Changing application specific settings

Type this command into your terminal.

winecfg
  • Click on Add Application...
  • Navigate to where the .exe is and choose that program
  • The dropdown at the bottom allows you to choose which version of Windows Wine should emulate. Also, any changes to the Libraries and Graphics tabs will only affect the chosen application in the Applications tab. 


EmoticonEmoticon