Saturday, July 7, 2012

How to install wine


  •  Installation

Before to start we need First to remove the installed wine using the command.
sudo apt-get autoremove wine –purge
Then remove .wine directory
cd /home/zinovsky
sudo rm -rf .wine
Now we will add wine repository to install the latest stable release of wine:
For Ubuntu and LinuxMint, you can add wine repository to install the latest stable release of wine:
sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update && sudo apt-get install wine
- For Fedora 12/13/14 enable rpm fusion repository by installing this : RPM Fusion free for Fedora 12, 13 and 14
- For Centos/RHEL add this repository :RPM Fusion free for RHEL5 or compatible like CentOS
-For other Linux distribution , go to download link and choose the repository for your current distribution (OpensuseMandriva, Slackware, Debian, FreeBSD, PCBSD..) then install the latest version of  wine.
Now wine is installed and ready to go. But with the actual configuration you will not be able to install some softwares like photoshop or games because mostly these need  special configuration of wine and some necessery DLLs and libraries to work properly.
  •  Configuration

After that latest version of wine is installed, we need to run winecfg, this will create the .wine directory in our home directory.
Open terminal and run :
winecfg
After the .wine directory is created, we can start installing some necessery DLL and Libraries to make wine fully functional. To do that we will install first winetricks, a script that will help us install all the needed DLLs and libraries the easy way:
Open terminal and past the following commands :
cd /home/zinovsky/.wine
 wget http://www.kegel.com/wine/winetricks
Now make winetricks executable :
sudo chmod +x ./winetricks
Now we will install the needed dlls and libraries
Note that you can add or remove libraries depending of your system.
./winetricks d3dx9 droid winxp sound=alsa volnum vcrun2008 dotnet20 ie6 corefonts
d3dx9 : This will installlibraries directx
droid : This will install droid fonts
If you have an Nvidia graphic card you need to install physx Technology.
./winetricks physx
Some configuration can be done also from “winecfg” Like to configure system to set winever to XP : winxp, or set sound driver to use alsa sound=alsa.
Now you have wine installed and configured to install latest windows applications.
Now if you want to play latest windows games you will need to make some more configurations in the windows registry.
Open terminal and type :
wine regedit
You will get this screen:
Now open new strings and enter this configuration :
“DirectDrawRenderer”=”opengl”
“Nonpower2Mode”=”repack”
“OffscreenRenderingMode”=”fbo”
“RenderTargetLockMode”=”auto”
“UseGLSL”=”readtex”
“VertexShaderMode”=”hardware”
“VideoDescription”=”NVIDIA GeForce 8400 GS”   (Change this to your current Graphics card setting)
“VideoDriver”=”nv4_disp.dll” 
“VideoMemorySize”=”500″   (Use your current video memory size)
For ATI GPU use : “VideoDriver”=”ati2dvag.dll” for Video discription and video memory use  your current video card settings.
Registry_Editor_001
The configuration above is common for most of games, if this doesn`t work for you please go to :
2- On the left menu click on Browse Apps
3- Use the filter and look for the game you want to install.
3- filter
4- Change wine configuration to match with currect game.
For example to install and play Call of Duty: Black Ops
I had to set “UseGLSL”=”disabled” so the configuration become :
“DirectDrawRenderer”=”opengl”
“Nonpower2Mode”=”repack”
“OffscreenRenderingMode”=”fbo”
“RenderTargetLockMode”=”auto”
“UseGLSL”=”disabled”
“VertexShaderMode”=”hardware”
“VideoDescription”=”NVIDIA GeForce 8400 GS” (Change this to your current Graphics card setting)
“VideoDriver”=”nv4_disp.dll”
“VideoMemorySize”=”500″   (Use your current video memory size)
  is done.
  • Use of WINEPREFIX

Installing more than a software or game using wine can result a conflict, because every software use native  libraries or different configuration of wine to work properly, that is why it is advised in this case to use wineprefix, 
{xtypo_quote_right}A prefix holds a virtual windows with separate wine settings (drives, virtual desktop, special dlls and so on)
Prefixes are set with the environment variable WINEPREFIX{/xtypo_quote_right}
Wineprefix permit to create a different folder with different configuration for each installed software or Game using wine.
Using wineprefix :
To use wineprefix, when you want to install a software run this command:
WINEPREFIX=/home/zinovsky/.WINEPREFIX wine softwarename.exe 
*Change /home/zinovsky to your current home directory  
*For each installed software or game use for example :/home/zinovsky/.WINEPREFIX1 for game1 ,/home/zinovsky/.WINEPREFIX2 for game 2……etc.
wineprefix

  •  How to prevent Wine from changing the filetype associations on the system or adding unwanted menu entries/desktop links when you install a Windows program?

If you do not want the installer for a Windows app to change filetype associations, add menu items, or create desktop links, then you have to disable winemenubuilder.exe . There are several ways to do this:
  1. In winecfg: before running the installer, run winecfg. Go to the Libraries tab and typewinemenubuilder.exe into the “New overrides” box (it is not in the dropdown list). Click add, then select it from the “Existing overrides” box. Click “Edit” and select “Disable” from the list, then click “Apply.”
  2. Registry file: If you need to apply the setting many times (e.g., every time you recreate the Wine prefix), this approach may be more convenient. Create a text file named with extension .reg (e.g.,disable-winemenubuilder.reg) containing the following:
    [HKEY_CURRENT_USERSoftwareWineDllOverrides]"winemenubuilder.exe"=""
    To apply the setting, run:
    regedit disable-winemenubuilder.reg
  3. Environment variable: set the WINEDLLOVERRIDES environment variable when you run the installer, example
    WINEDLLOVERRIDES=winemenubuilder.exe=d wine setup.exe
Disabling winemenubuilder.exe will cause wine programs to print errors that they cannot find it (though the errors do not seem to interfere with program operation). An alternative approach that avoids the errors is to replace it with the do-nothing program. Compile the following with MinGW’s gcc under wine and place the executable at C:WindowsSystem32winemenubuilder.exe :
{codecitation}
#include <stdio.h>
int main()
{
/* Do nothing */
return 0;
}
{/codecitation}

Then follow the same procedure as above, but set winemenubuilder.exe to “native” instead of “disable” in winecfg, or use the following registry file or environment variable:
[HKEY_CURRENT_USERSoftwareWineDllOverrides]"winemenubuilder.exe"="native"
WINEDLLOVERRIDES=winemenubuilder.exe=n wine setup.exe
  • Remove all programs installed under Wine

To remove all programs installed under Wine, remove the wineprefix (usually the ~/.winedirectory) by pasting the following command into a terminal:
rm -rf $HOME/.wine
But that doesn’t remove them from the system menu; to clean out the menus, carefully paste the following commands into a terminal:
rm -f $HOME/.config/menus/applications-merged/wine*rm -rf $HOME/.local/share/applications/winerm -f $HOME/.local/share/desktop-directories/wine*rm -f $HOME/.local/share/icons/????_*.{xpm,png}rm -f $HOME/.local/share/icons/*-x-wine-*.{xpm,png}
Is done.
{module post forum}
Useful Links:Thanks to Ubuntulife, wineHQ

No comments:

Post a Comment